Skip to content

Latest commit

 

History

History
118 lines (84 loc) · 3.91 KB

File metadata and controls

118 lines (84 loc) · 3.91 KB

Focus ⇐ Animation

Focus animation is responsible for attention seekers for your shape.

Kind: global class
Extends: Animation
Since: 1.0.0

new Focus([options])

Create Focus animation instance.

Param Type Description
[options] Object Options object
[options.direction] String Direction of the animation
[options.offset] Number Offset in cells, by how many cells you need to shift the shape
[options.repeat] Number How many times you need to repeat this animation

Example

Focus.create({
  direction: 'shakeX',
  offset: 10,
  repeat: 2
}).animate(someShapeInstance);

focus.getDuration() ⇒ Number

Get total duration of the animation taking to attention repeat count.

Kind: instance method of Focus

focus.getDirection() ⇒ String

Get direction of the animation.

Kind: instance method of Focus

focus.setDirection([direction]) ⇒ Focus

Set new direction of the animation.

Kind: instance method of Focus

Param Type Default Description
[direction] String 'shakeX' Direction of the animation seeker

focus.getOffset() ⇒ Number

Get interval value used for moving shape.

Kind: instance method of Focus

focus.setOffset([offset]) ⇒ Focus

Set interval value used for moving shape.

Kind: instance method of Focus

Param Type Default Description
[offset] Number 5 By how many cell you want to shift the shape when animate

focus.getRepeat() ⇒ Number

Get repeat count of the attractor.

Kind: instance method of Focus

focus.setRepeat([repeat]) ⇒ Focus

Set repeat count of the attractor.

Kind: instance method of Focus

Param Type Default Description
[repeat] Number 1 How many times you want to repeat this attractor

focus.animate(shape) ⇒ Promise

Main method that calls when shape need to be animated.

Kind: instance method of Focus
Fulfil: Shape When animation is done, fulfils with Shape instance
Reject: String If direction is unknown, rejects the promise

Param Type
shape Shape

focus.toObject() ⇒ Object

Serializes animation to Object representation.

Kind: instance method of Focus