Animator

clay.animation. Animator

# new Animator(target, loop, getter, setter, interpolater)

Source:

Animator object can only be created by Animation.prototype.animate method. After created, we can use clay.animation.Animator#when to add all keyframes and clay.animation.Animator#start it. Clips will be automatically created and added to the animation instance which created this deferred object.

Parameters:
Name Type Description
target Object
loop boolean
getter function
setter function
interpolater function

Methods

# delay(time) → {clay.animation.Animator}

Source:

Delay given milliseconds

Parameters:
Name Type Description
time number
Returns:
Type
clay.animation.Animator

# done(func) → {clay.animation.Animator}

Source:

Callback after animation finished

Parameters:
Name Type Description
func function
Returns:
Type
clay.animation.Animator

# during(callback) → {clay.animation.Animator}

Source:

callback when running animation

Parameters:
Name Type Description
callback function

callback have two args, animating target and current percent

Returns:
Type
clay.animation.Animator

# getClips() → {Array.<clay.animation.Clip>}

Source:

Get all clips created in start method.

Returns:
Type
Array.<clay.animation.Clip>

# start(easing) → {clay.animation.Animator}

Source:

Start the animation

Parameters:
Name Type Description
easing string | function
Returns:
Type
clay.animation.Animator

# stop()

Source:

Stop the animation

# then(time, props, easingopt) → {clay.animation.Animator}

Source:
Parameters:
Name Type Attributes Description
time number

During time since last keyframe

props Object

A key-value object. Value can be number, 1d and 2d array

easing string | function <optional>
Returns:
Type
clay.animation.Animator

# when(time, props, easingopt) → {clay.animation.Animator}

Source:
Parameters:
Name Type Attributes Description
time number

Keyframe time using millisecond

props Object

A key-value object. Value can be number, 1d and 2d array

easing string | function <optional>
Returns:
Type
clay.animation.Animator