Focus animation is responsible for attention seekers for your shape.
Kind: global class
Extends: Animation
Since: 1.0.0
- Focus ⇐
Animation- new Focus([options])
- .getDuration() ⇒
Number - .getDirection() ⇒
String - .setDirection([direction]) ⇒
Focus - .getOffset() ⇒
Number - .setOffset([offset]) ⇒
Focus - .getRepeat() ⇒
Number - .setRepeat([repeat]) ⇒
Focus - .animate(shape) ⇒
Promise - .toObject() ⇒
Object
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);Get total duration of the animation taking to attention repeat count.
Kind: instance method of Focus
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 |
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 |
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 |
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 |
Serializes animation to Object representation.
Kind: instance method of Focus