Class com.thelab.tween.TweenFunction

com.thelab.tween.TweenFunction

Description

Class that holds all information about the tweening functions used by the Climv. It also gives the possibility to create custom functions.

Field Index

_function

Method Index

addEquation(), addWaveEquation(), catmull(), solve(), wave()

Field Detail

_function

static _function:Object
Container Object of all Tweening functions default and custom.

Method Detail

addEquation

static function addEquation(name:String, c5:Number, c4:Number, c3:Number, c2:Number, c1:Number, reverse:Boolean, modifier:Function)

Insert a new equation into the Class. The equation will be available for later use in the Climv Class.

Parameters

nameEquation name
c55th order coeficient of the polynom.
c44th order coeficient of the polynom.
c33rd order coeficient of the polynom.
c22nd order coeficient of the polynom.
c11st order coeficient of the polynom.
modifiermodifirer constant that will be applied in the result. Modifier is a function that receives a number and make any kind of calculation on it before using it.

addWaveEquation

static function addWaveEquation(func:Function, name:String)

Insert a new custom equation for wave tweenings. Wave functions has templates like that wave(func:String,angle:Number,range:Number,offset:Number):Number

Parameters

funcFunction reference.
nameName of the function.

solve

static function solve(coef:Array, value:Number):Number

Receives an Array of coeficients and a value then solve the polynom.

Parameters

coefArray with 5 coeficients and 1 modifier in the end.
valueThe value that will be applied in the formula.

Return

Number - The result of the polynom.

wave

static function wave(angle:Number, range:Number, offset:Number, phase:Number, scale:Number, func:Function):Number

Receives the name of wave function an angle the result range and offset. Returns the waving value for it.

Parameters

rangeMaximum range of the result.
offsetStarting offset of the result.
funcWave function name.

Return

Number - Result.

catmull

static function catmull(ratio:Number, p0, p1, p2, p3):Object

Solve the Catmull Curve between 2 points (P1 and P2) with 2 control points ( P0 and P3)

Parameters

ratioNormalized value to interpolate between the 2 points.
p0Control Point 1
p1Point 1
p2Point 2
p3Control Point 2

Return

Object - Point with the interpolated point between P1 and P2