Tweenable

shifty. Tweenable

new Tweenable(initialStateopt, configopt)

Source:
Parameters:
Name Type Attributes Default Description
initialState Object <optional>
{}

The values that the initial tween should start at if a from value is not provided to shifty.Tweenable#tween or shifty.Tweenable#setConfig.

config shifty.tweenConfig <optional>

Configuration object to be passed to shifty.Tweenable#setConfig.

Members

(static) filters :Object.<shifty.filter>

The shifty.filters available for use. These filters are automatically applied at tween-time by Shifty. You can define your own shifty.filters and attach them to this object.

Source:
Type:

(static) formulas :Object.<shifty.easingFunction>

A static Object of shifty.easingFunctions that can by used by Shifty. The default values are defined in easing-functions.js, but you can add your own shifty.easingFunctions by defining them as keys to this Object.

Shifty ships with an implementation of Robert Penner's easing equations, as adapted from Scripty2's implementation.

See the Pen Shifty - Easing formula names by Jeremy Kahn (@jeremyckahn) on CodePen.

Source:
Type:

Methods

(static) now() → {number}

Source:
Returns:
Type:
number

The current timestamp.

(static) setScheduleFunction(fn) → {shifty.scheduleFunction}

Set a custom schedule function.

By default, requestAnimationFrame is used if available, otherwise setTimeout is used.

Source:
Parameters:
Name Type Description
fn shifty.scheduleFunction

The function to be used to schedule the next frame to be rendered.

Returns:
Type:
shifty.scheduleFunction

The function that was set.

dispose()

delete all "own" properties. Call this when the shifty.Tweenable instance is no longer needed to free memory.

Source:

get() → {Object}

Source:
Returns:
Type:
Object

The current state.

isPlaying() → {boolean}

Whether or not a tween is running.

Source:
Returns:
Type:
boolean

pause() → {shifty.Tweenable}

Pause a tween. Paused tweens can be resumed from the point at which they were paused. If a tween is not running, this is a no-op.

Source:
Returns:
Type:
shifty.Tweenable

resume() → {external:Promise}

Resume a paused tween.

Source:
Returns:
Type:
external:Promise

seek(millisecond) → {shifty.Tweenable}

Move the state of the animation to a specific point in the tween's timeline. If the animation is not running, this will cause shifty.stepFunction handlers to be called.

Source:
Parameters:
Name Type Description
millisecond millisecond

The millisecond of the animation to seek to. This must not be less than 0.

Returns:
Type:
shifty.Tweenable

set(state)

Set the current state.

Source:
Parameters:
Name Type Description
state Object

The state to set.

setConfig(configopt) → {shifty.Tweenable}

Configure a tween that will start at some point in the future.

Source:
Parameters:
Name Type Attributes Default Description
config shifty.tweenConfig <optional>
{}
Returns:
Type:
shifty.Tweenable

setScheduleFunction(scheduleFunction)

Deprecated:
Source:
Parameters:
Name Type Description
scheduleFunction shifty.scheduleFunction

stop(gotoEndopt) → {shifty.Tweenable}

Stops and cancels a tween. If a tween is not running, this is a no-op.

Source:
Parameters:
Name Type Attributes Description
gotoEnd boolean <optional>

If false, the tween just stops at its current state, and the tween promise is not resolved. If true, the tweened object's values are instantly set to the target values, and the promise is resolved.

Returns:
Type:
shifty.Tweenable

tween(configopt) → {external:Promise}

Configure and start a tween.

Source:
Parameters:
Name Type Attributes Description
config shifty.tweenConfig <optional>

Gets passed to shifty.Tweenable#setConfig.

Returns:
Type:
external:Promise