WaveMotion (com.robertpenner.effects.WaveMotion)

mx.transitions.Tween
        |
        +--com.robertpenner.effects.WaveMotion
class WaveMotion
extends Tween

The WaveMotion class encapsulates oscillation and allows easy manipulation of wave properties.

Availability:

ActionScript 2.0; Flash Player 6

Property summary

Property Description
amp:Number

The amplitude of the wave.

period:Number

The period of the wave.

freq:Number

The frequency of the wave.

timeShift:Number

The timeshift of the wave.

offset:Number

The offset of the wave.

duration:Number

The duration of the tweened animation in frames or seconds.

finish:Number

The last tweened value for the end of the tweened animation.

FPS:Number

The number of frames per second of the tweened animation.

position:Number

The current value of the target movie clip's property being tweened.

time:Number

The current time within the duration of the animation.

Event summary

Event Description
onMotionChanged = function() {}

Event broadcast with each change in the tweened object's property that is being animated.

onMotionFinished = function() {}

Event broadcast when the Tween object finishes its animation.

onMotionLooped = function() {}

Event broadcast when the Tween object loops.

onMotionResumed = function() {}

Event broadcast when the Tween.resume() method is called, causing the tweened animation to resume.

onMotionStarted = function() {}

Event broadcast when the Tween.start() method is called, causing the tweened animation to start.

onMotionStopped = function() {}

Event broadcast when the Tween.stop() method is called, causing the tweened animation to stop.

Method summary

Method Description
setWavePhysics(amp:Number, period:Number, timeShift:Number, offset:Number) : Void

Sets the amp, period, timeShift, and offset of the wave.

getPosition(t:Number) : Number

Returns the position of the WaveMotion at a specified time.

continueTo(finish:Number, duration:Number) : Void

Instructs the tweened animation to continue from its current value to a new value.

fforward() : Void

Forwards the tweened animation directly to the end of the animation.

nextFrame() : Void

Forwards the tweened animation to the next frame.

prevFrame() : Void

Directs the tweened animation to the frame previous to the current frame.

resume() : Void

Resumes a tweened animation from its stopped point in the animation.

rewind() : Void

Rewinds a tweened animation to the beginning of the tweened animation.

start() : Void

Starts the tweened animation from the beginning.

stop() : Void

Stops the tweened animation at its current position.

toString() : String

Returns the class name, "[WaveMotion]".

yoyo() : Void

Instructs the tweened animation to play in reverse from its last direction of tweened property increments.

WaveMotion(obj:Object, prop:String, amp:Number, period:Number, offset:Number, duration:Number, useSeconds:Boolean)

Usage


var myWave:WaveMotion = new WaveMotion(this, "_x", 100, 1, 0, 0, true);

Parameters

obj:Object - The object which the WaveMotion targets.

prop:String - The name of the property (in obj) that will be affected.

amp:Number - The magnitude of the wave's oscillation.

period:Number - The length of time it takes for the wave to go through one oscillation.

offset:Number - The amount to shift the wave vertically on the position axis.

duration:Number - The length of time of the motion; set to infinity if negative, 0 or omitted.

useSeconds:Boolean - A flag specifying whether to use seconds instead of frames, defaults to false.

Description

Creates an instance of the WaveMotion class.


setWavePhysics(amp:Number, period:Number, timeShift:Number, offset:Number) : Void

Usage


myWave.setWavePhysics(80,2,.5,3);

Parameters

amp:Number - The magnitude of the wave's oscillation.

period:Number - The length of time it takes for the wave to go through one oscillation.

timeShift:Number - The amount to shift the wave horizontally on the time axis.

offset:Number - The amount to shift the wave vertically on the position axis.

Returns

Nothing.

Description

Sets the amp, period, timeShift, and offset of the wave.


getPosition(t:Number) : Number

Usage


trace (myWave.getPosition());

Parameters

t:Number - The time to check the object's position; set to the current time if omitted.

Returns

The position of the wave.

Description

Returns the position of the WaveMotion at a specified time.


continueTo(finish:Number, duration:Number) : Void

Usage


myTween.continueTo(myFinish, myDuration);

Parameters

finish:Number - A number indicating the ending value of the target object property that is to be tweened.

duration:Number - A number indicating the length of time or number of frames for the tween motion.

Returns

Nothing.

Description

Instructs the tweened animation to continue from its current value to a new value.


fforward() : Void

Usage


myTween.fforward();

Parameters

Returns

Nothing.

Description

Forwards the tweened animation directly to the end of the animation.


nextFrame() : Void

Usage


myTween.nextFrame();

Parameters

Returns

Nothing.

Description

Forwards the tweened animation to the next frame.


prevFrame() : Void

Usage


myTween.prevFrame();

Parameters

Returns

Nothing.

Description

Directs the tweened animation to the frame previous to the current frame.


resume() : Void

Usage


myTween.resume();

Parameters

Returns

Nothing.

Description

Resumes a tweened animation from its stopped point in the animation.


rewind() : Void

Usage


myTween.rewind();

Parameters

Returns

Nothing.

Description

Rewinds a tweened animation to the beginning of the tweened animation.


start() : Void

Usage


myTween.start();

Parameters

Returns

Nothing.

Description

Starts the tweened animation from the beginning.


stop() : Void

Usage


myTween.stop();

Parameters

Returns

Nothing.

Description

Stops the tweened animation at its current position.


toString() : String

Usage


trace (myWave.toString());
trace (myWave);

Parameters

Returns

Returns the class name, "[WaveMotion]".

Description

Returns the class name, "[WaveMotion]".


yoyo() : Void

Usage


myTween.yoyo();

Parameters

Returns

Nothing.

Description

Instructs the tweened animation to play in reverse from its last direction of tweened property increments.


onMotionChanged = function() {}

Usage


myTween.onMotionChanged = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast with each change in the tweened object's property that is being animated.


onMotionFinished = function() {}

Usage


myTween.onMotionFinished = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween object finishes its animation.


onMotionLooped = function() {}

Usage


myTween.onMotionLooped = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween object loops.


onMotionResumed = function() {}

Usage


myTween.onMotionResumed = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween.resume() method is called, causing the tweened animation to resume.


onMotionStarted = function() {}

Usage


myTween.onMotionStarted = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween.start() method is called, causing the tweened animation to start.


onMotionStopped = function() {}

Usage


myTween.onMotionStopped = function() {
	// ...
};

Parameters

Returns

Nothing.

Description

Event broadcast when the Tween.stop() method is called, causing the tweened animation to stop.


amp : Number

Usage


myWave.amp = 80;

Description

The amplitude of the wave.


period : Number

Usage


myWave.period = 2;

Description

The period of the wave.


freq : Number

Usage


myWave.freq = .5;

Description

The frequency of the wave.


timeShift : Number

Usage


myWave.timeShift = .5;

Description

The timeshift of the wave.


offset : Number

Usage


myWave.offset = 3;

Description

The offset of the wave.


duration : Number

Usage


trace (myTween.duration);

Description

The duration of the tweened animation in frames or seconds.


finish : Number

Usage


trace (myTween.finish);

Description

The last tweened value for the end of the tweened animation.


FPS : Number

Usage


trace (myTween.FPS);

Description

The number of frames per second of the tweened animation.


position : Number

Usage


trace (myTween.position);

Description

The current value of the target movie clip's property being tweened.


time : Number

Usage


trace (myTween.time);

Description

The current time within the duration of the animation.