AnimationModule Module

The AnimationModule class implements object animation.

Usage

var Animation = require('Animation');

Properties

PropertyDescription

samplers

(get) samplers: SamplerFactory (set) (Not Available)

Specifies an instance of a SamplerFactory object.

Methods

MethodDescription

animate

animate(driver: Driver, sampler: ScalarSampler): ScalarSignal animate(driver: Driver, sampler: ArrayOfScalarSamplers): ArrayOfScalarSignals animate(driver: Driver, sampler: RotationSampler): RotationSignal animate(driver: Driver, sampler: ColorSampler): RgbaSignal

Combines the driver and the sampler to create a signal that can be used to animate arbitrary properties of arbitrary objects.

For TimeDriver-based animations the animation will start only when TimeDriver.start is invoked.

timeDriver

timeDriver(timeDriverParams: {durationMilliseconds: number, loopCount: ?number, mirror: ?boolean}): TimeDriver

Returns a TimeDriver object that drives an animation for the specified parameters. loopCount defines the number of iterations before the time driver stops; this can be infinity. When mirror is TRUE, the time driver follows a yoyo effect with every odd iteration going forwards and every even iteration going backwards.

valueDriver

valueDriver(value: ScalarSignal, min: number, max: number): ValueDriver

Returns a ValueDriver object that drives an animation based on values emitted from a ScalarValue. The signal values are normalized and clamped to maximum and minimum values.

Classes

ClassDescription

ArrayOfScalarSamplers

The ArrayOfScalarSamplers class describes an array of scalar samplers.

ArrayOfScalarSignals

The ArrayOfScalarSignals class describes an array of scalar signals.

ColorSampler

The ColorSampler class encapsulates a color sampler.

Driver

The Driver class encapsulates an animation driver.

SamplerFactory

The SamplerFactory class creates different types of animation samplers.

ScalarSampler

The ScalarSampler class encapsulates a scalar value sampler.

TimeDriver

The TimeDriver class controls an animation.

ValueDriver

The ValueDriver class controls an animation value.

Example

Using an Animation Driver

A Driver object uses a rule to tell a sampler where along the interval of allowed values. The driver may tell the sampler to move along an interval monotonically (as with a time driver), to move back and forth (as with a yo-yo time driver), or to be tied to another value (as with a value driver). See the reference below for how to create the various kinds of drivers, and what each does.

const Animation = require('Animation');

// animation loops every second
var driver = Animation.timeDriver({durationMilliseconds:1000}); 
driver.start();