-
Notifications
You must be signed in to change notification settings - Fork 89
Functions
clabe45 edited this page Dec 12, 2018
·
5 revisions
Functions are a powerful feature that allows a callback function to determine the value of a property at a given frame. This means that properties can be as dynamic as the user defines them to be.
// the layer's `x` property will always be one tenth of its time elapsed
options.x = (layer, reltime) => 0.1 * reltime;
// the element's opacity will be randomized each animation frame
options.opacity = (layer, reltime) => Math.random();
// or simply
options.opacity = Math.random;
The value of this property is a function that is passed two arguments, element
and reltime
.
Argument | Description |
---|---|
element |
the movie or layer that to which the property belongs to |
reltime |
the time relative to that element as a DOMHighResTimeStamp
|
Functions are a powerful feature that allow for extremely dynamic properties.