new FLIP(config)
Creates a new FLIP helper.
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object | The configuration for the helper.
Properties
|
Members
(static) version
Returns the library version.
Methods
(static) extend(name, player)
Extends FLIP to be able to play. Allows for the use of libraries when it
comes to playback. The functions in the player object are all copied and
bound to the instance of the FLIP Helper on instantiation.
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
name |
String | The name of the player, e.g. 'rAF' . |
||||||
player |
Object | The object with the playback functions.
Properties
|
(static) group() → {FlipGroup}
Creates a group of FLIP helpers, usually used when you want to have some
form of composite animation, with related but visually independent
elements.
Returns:
An object which has the same API as an individual FLIP
helper, but controls the group as a whole.
- Type
- FlipGroup
addClass(className)
Convenience method to add a class to the element.
Parameters:
Name | Type | Description |
---|---|---|
className |
string | The class name to add to the element. |
cleanUpAndFireEvent_()
Function to call to get rid of all the transforms, opacity, internal values
and fire an event for the FLIP completion.
first()
Snapshots the layout and opacity information for the element.
invert()
Moves the element back to its start position, size, and opacity by applying
changes to its transform and opacity values.
last(lastClassNameopt)
Applies the class that moves the element to its last position. It then
takes a snapshot of the element's final location and opacity.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
lastClassName |
string |
<optional> |
The class name applied to the element that moves it to its final position. |
play(startTimeopt)
Plays the animation.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
startTime |
Number |
<optional> |
The time the animation should start (using
window.performance.now as the source of truth). |
removeClass(className)
Convenience method to remove a class to the element.
Parameters:
Name | Type | Description |
---|---|---|
className |
string | The class name to remove from the element. |
snapshot(lastClassNameopt)
Convenience method that calls
first()
, last()
,
and invert()
immediately after each other.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
lastClassName |
string |
<optional> |
The class name applied to the element that moves it to its final position. |