Skip to content

Functions

clabe45 edited this page Dec 12, 2018 · 5 revisions

Overview

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.

Basic Examples

// 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;

Callback

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

Conclusion

Functions are a powerful feature that allow for extremely dynamic properties.

Clone this wiki locally