MoveOnQuadCurve Documentation
Author: Alex Uhlmann
Last Modified: 09/24/05 19:04:13
Summary
MoveOnQuadCurve class:
MoveOnQuadCurve Properties:
MoveOnQuadCurve Methods:
version: Documentation not provided.
description:
Moves a movieclip along a specified quadratic bezier curve in a specified time and easing equation. The curve is specified with three points. Start point, mid point or control point, end point. Note: The mid point is the point the curve passes through. With the useControlPoints method you can specify the control point instead of the mid point. The MovieClip.curveTo method uses control points i.e.
Example 1: (Example .swf) Declare 6 variables to store the three points that define the curve for easy access. To visualize the points and the curve draw it with the classes of the de.alex_uhlmann.animationpackage.drawing package. Then, move the movieclip along the specified curve in 4 seconds using Bounce easing.
Example 2: Move a movieclip along the curve in 4 seconds using circular easing.var x1:Number = 100; var y1:Number = 100; var x2:Number = 400; var y2:Number = 200; var x3:Number = 500; var y3:Number = 400; var myQuadCurve:QuadCurve = new QuadCurve(x1,y1,x2,y2,x3,y3); myQuadCurve.lineStyle(6,0x8CA6BD); myQuadCurve.draw(); Shape.lineRGB_def = 0x9C3031; Shape.fillRGB_def = 0x9C3031; new Ellipse(x1,y1,5,5).draw(); new Ellipse(x2,y2,5,5).draw(); new Ellipse(x3,y3,5,5).draw(); var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc); myMOC.animationStyle(4000,Bounce.easeOut); myMOC.run(x1,y1,x2,y2,x3,y3);
new MoveOnQuadCurve(mc).run(100,100,300,300,500,100,4000,Circ.easeInOut);
You can specify the duration, easing equation and callback properties either with setting the properies directly or with the animationStyle() method like it is used in de.alex_uhlmann.animationpackage.drawing.
Example 3:
Example 4: The alternative way is shorter. The same like above in one line.var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc); myMOC.animationStyle(4000,Circ.easeInOut); myMOC.run(100,100,300,300,500,100);
Example 5: You can also specify the properties via the constructor. This might come in handy if you're using the Sequence or Parallel class. Take a look at their class documentations for more information. The animate() method and its start and end parameters might also be useful.new MoveOnQuadCurve(mc).run(100,100,300,300,500,100,4000,Circ.easeInOut);
var myMoveOnQuadCurve:MoveOnQuadCurve = new MoveOnQuadCurve(mc,100,100,300,300,500,100,4000,Circ.easeInOut); myMoveOnQuadCurve.animate(0,100);
usage:
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc);
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc, x1, y1, x2, y2, x3, y3);
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc, x1, y1, x2, y2, x3, y3, duration);
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc, x1, y1, x2, y2, x3, y3, duration, callback);
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc, x1, y1, x2, y2, x3, y3, duration, easing, callback);
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc, x1, y1, x2, y2, x3, y3, withControlpoints);
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc, x1, y1, x2, y2, x3, y3, withControlpoints, duration);
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc, x1, y1, x2, y2, x3, y3, withControlpoints, duration, callback);
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc, x1, y1, x2, y2, x3, y3, withControlpoints, duration, easing, callback);
parameters:
(Number) Duration of animation in milliseconds or frames. Default is milliseconds.
(Object) Easing equation in Robert Penner style. Default equation is Linear.easeNone. www.robertpenner.com/easing/
(String) Function to invoke after animation. See APCore class.
description: Documentation not provided.
usage:
myMOC.run(x1, y1, x2, y2, x3, y3);
myMOC.run(x1, y1, x2, y2, x3, y3, duration);
myMOC.run(x1, y1, x2, y2, x3, y3, duration, callback);
myMOC.run(x1, y1, x2, y2, x3, y3, duration, easing, callback);
myMOC.run(x1, y1, x2, y2, x3, y3, withControlpoints);
myMOC.run(x1, y1, x2, y2, x3, y3, withControlpoints, duration);
myMOC.run(x1, y1, x2, y2, x3, y3, withControlpoints, duration, callback);
myMOC.run(x1, y1, x2, y2, x3, y3, withControlpoints, duration, easing, callback);
parameters:
returns: void
description: similar to the run() method. Offers start and end parameters.
usage:
myMOC.animate(start, end);
parameters:
returns: void
description: jumps to a specific step of the animation and stays there.
usage:
instance.goto(percentage);
parameters:
returns: void
description: set the animation style properties for your animation. Notice that if your easing equation supports additional parameters you can send those parameters with the easing parameter in animationStyle. You have to send an Array as easing parameter. The first element has to be the easing equation in Robert Penner style. The following parameters can be your additional parameters. i.e.:
See also "Customizable easing equations" in readme for more information.var myRotation:Rotation = new Rotation(mc); myRotation.animationStyle(2000,[Back.easeOut,4]); myRotation.run(360);
usage:
myInstance.animationStyle(duration);
myInstance.animationStyle(duration, callback);
myInstance.animationStyle(duration, easing, callback);
parameters:
returns: Void.
description: offers the opportunity to specify control points between the start and end points of the curve instead of points on the curve. Default is false. If true points between start and end points are control points. If false points between start and end points are points on the curve.
usage:
myInstance.useControlPoints(withControlpoints);
parameters:
true or false.returns: void
description: offers the opportunity to rotate the object towards the curve while animating. Default is false. If true the object orientates on the curve. If false the object's rotation will not be altered. Example 1: (Example .swf)
var myMOC:MoveOnQuadCurve = new MoveOnQuadCurve(mc); myMOC.animationStyle(2000,Sine.easeInOut); myMOC.orientToPath(true); myMOC.run(100,100,300,300,500,100);
usage:
myInstance.orientToPath(pathOrientation);
parameters:
true or false.returns: void
description: offers the opportunity to rotate the object on the curve while animating. Default is false. If true the object orientates on the curve. If false the object's rotation will not be altered. See class documentation.
usage:
myInstance.orientToPath(rotateOn);
parameters:
true or false.returns: void
description: rounds animation results to integers. (might be usefull for animating pixelfonts). Default is false.
usage:
myInstance.roundResult(event, listener);
parameters:
true rounds the result. Animates with integers. Less accuracy.returns: Void.
description: Flash does not guaranteed that time-based tweening will reach the end value(s) of your animation. By default AnimationPackage guarantees that the end value(s) will be reached. The forceEnd method allows you to disable this guarantee and only accept the values from your easing equation. In certain situations this can lead to a smoother ending of the animation. Notice that in frame-based tweening the end value(s) will always be reached.
usage:
myInstance.forceEnd(forceEndVal);
parameters:
true or false.returns: Void.
description: returns the optimization mode. See setOptimizationMode for more information.
usage: getOptimizationMode();
returns: Boolean
description:
Allows to explicitly remove parts of the animation that don't change during
the animation.
This can add additional performance to your animation. Note that
setting this method to true has side effects. If all start and end values match,
the animation won't start and will immediatly invoke an onEnd event.
The order of values returned by getStartValue(s), getCurrentValue(s),
getEndValue(s) and the value property of the eventObject returned
by EventDispatcher might change if you set this method to true. You can
still retrieve the parts of the animation that are actually animated
if you access the Animator instance of your animation class via
myAnimator. Ask myInstance.myAnimator.setter to retrieve
all currently animated parts of the animation. See Animator
documentation. Of cource, if you know your input values you would
probably look at them.
Note that the AnimationCore class offers a static setOptimizationModes method (note the last "s" at the end) that allows you to remove parts of 'all' your animations that don't change during the animation.
usage:
myInstance.setOptimizationMode(optimize);
parameters:
returns: Void.
description: returns the current tween mode used by the instance. Please check with AnimationCore.setTweenModes for more information.
usage: getTweenMode();
returns: String that specifies the tween mode. Either AnimationCore.INTERVAL or AnimationCore.FRAMES.
description: sets the current tween mode used by the instance. Please check with AnimationCore.setTweenModes for more information.
usage: setTweenMode();
parameters:
returns: true if setting tween mode was successful,
false if not successful.
description: returns the current duration mode used by the instance. Please check with AnimationCore.setTweenModes for more information.
usage: getDurationMode();
returns: String that specifies the duration mode. Either AnimationCore.MS or AnimationCore.FRAMES.
description: sets the current duration mode used by the instance. Please check with AnimationCore.setTweenModes for more information.
usage: setDurationMode();
parameters:
returns: true if setting duration mode was successful,
false if not successful.
description: stops the animation if not locked..
usage: myInstance.stop();
returns: true if instance was successfully stopped.
false if instance could not be stopped, because it was locked.
description: pauses the animation if not locked. Call resume() to continue animation.
usage: myInstance.pause();
parameters:
returns: true if instance was successfully paused.
false if instance could not be paused, because it was locked.
description: continues the animation if not locked.
usage: myInstance.resume();
returns: true if instance was successfully resumed.
false if instance could not be resumed, because it was locked.
description: locks the animation to prevent pausing, resuming and stopping. Default is unlocked.
usage: myInstance.lock();
returns: Void.
description: unlocks the animation to allow pausing, resuming and stopping. Default is unlocked.
usage: myInstance.unlock();
returns: Void.
description: checks if the instance is currently animated.
usage: myInstance.isTweening();
returns: true if instance is tweening,
false if instance is not tweening.
description: returns the original, starting value of the current tween. Percentage.
usage: myInstance.getStartValue();
returns: Number
description: returns the targeted value of the current tween. Percentage.
usage: myInstance.getEndValue();
returns: Number
description: returns the current value of the current tween. Percentage.
usage: myInstance.getCurrentValue();
returns: Number
description: returns the current state of the animation in percentage. Especially usefull in combination with goto().
usage: myInstance.getCurrentPercentage();
returns: Number
description: returns the elapsed time or frames since the current tween started tweening.
usage: myInstance.getDurationElapsed();
returns: Number
description: returns the remaining time or frames since the current tween started tweening.
usage: myInstance.getDurationRemaining();
returns: Number
description: Subscribe to a predefined event. The following standard EventDispatcher events are broadcasted
onStart, broadcasted when animation starts.
onUpdate, broadcasted when animation updates.
onEnd, broadcasted when animation ends.
The even object returned, contains the following properties:
type (String) event broadcasted.
target (Object) event source.
value (Number) value to animate.
usage:
myMOC.addEventListener(event, listener);
myMOC.addEventListener(event, listener, handler);
parameters:
returns: Void.
description: Removes a listener from a subscribed event.
usage:
myMOC.removeEventListener(event, listener);
myMOC.removeEventListener(event, listener, handler);
parameters:
returns: Void.
description: GDispatcher specific feature. Removes all listeners for a specific event, or for all events.
usage:
myMOC.removeAllEventListeners();
myMOC.removeAllEventListeners(event);
parameters:
returns: Void.
description: GDispatcher specific feature. Checks if a listener is already subscribed to a certain event.
usage:
myMOC.eventListenerExists(event, listener);
myMOC.eventListenerExists(event, listener, handler);
parameters:
returns: true if event exists on listener.
false if event doesn't exist on listener.
description: returns a unique ID of the instance. Usefull for associative arrays.
usage: myInstance.getID();
returns: Number
description: returns the name of the class.
usage: myInstance.toString();
returns: String