AnimationCore Documentation

Author: Alex Uhlmann
Last Modified: 09/24/05 18:48:29


Summary

AnimationCore class:

- description

AnimationCore Properties:

- AnimationCore.duration_def
- AnimationCore.easing_def
- AnimationCore.callback_def
- AnimationCore.INTERVAL
- AnimationCore.FRAMES
- AnimationCore.MS

AnimationCore Methods:

- AnimationCore.getOptimizationModes
- AnimationCore.setOptimizationModes
- AnimationCore.getTweenModes
- AnimationCore.setTweenModes
- AnimationCore.getDurationModes
- AnimationCore.setDurationModes
- AnimationCore.getOverwriteModes
- AnimationCore.setOverwriteModes
- AnimationCore.pauseAll
- AnimationCore.resumeAll


AnimationCore class

version: Documentation not provided.

description:

All classes in AnimationPackage that use animations inherit their animationStyle properties from AnimationCore. If you don't specify the animationStyle properties either with the animationStyle() method or directly via the properties, the default animationStyle properties are used. AnimationCore gives you the opportunity to set and retrieve default properties for animationStyle properties. Here is how those default properties are defined by default:

AnimationCore.duration_def = 1000; AnimationCore.easing_def = Linear.easeNone; AnimationCore.callback_def = null;
Note that all default properties have the same name as their instance properties but the suffix "_def". For more information about the callback property, take a look at the APCore class documentation and the readme.htm > "Event Handling".

AnimationCore allows you to specify the tween-engine used by AnimationPackage. Like discussed in the readme.htm under "Tween-engine" you can choose between time-based tweening (INTERVAL), and frame-based tweening (FRAMES). By default time-based tweening is activated. You can change the tween mode either globally for all animations in AnimationPackage or seperatly for each instance. You change it globally with AnimationCore.setTweenModes() (see documentation below). In INTERVAL mode you control the duration of animations with milliseconds. In FRAMES mode, by default, you control the duration of animations with frames. Since this might be a little cumbersome for some developers, FRAMES mode can also accept milliseconds if you say so. See AnimationCore.setDurationModes for details. If you're using frame-based tweening and you're wondering why your animations are so slow and sluggish, then check your movie's frame rate.

Furthermore, AnimationCore stores functionality that is used by classes that use animations. This includes protected functionality to stop, pause, resume, lock and unlock animations and static pauseAll and resumeAll methods enable you to pause/resume all running animations.

usage:

private class constructor

AnimationCore Properties:

AnimationCore.duration_def

(Number)(static) Duration of animation in milliseconds or frames. Default is milliseconds.

AnimationCore.easing_def

(Function)(static) Easing equation in Robert Penner style. Default equation is Linear.easeNone. www.robertpenner.com/easing/

AnimationCore.callback_def

(String)(static) Function to invoke after animation. See APCore class.

AnimationCore.INTERVAL

(String)(static) Property that can be used to set the tween mode. See setTweenMode.

AnimationCore.FRAMES

(String)(static) Property that can be used to set the tween mode. See setTweenMode.

AnimationCore.MS

(String)(static) Property that can be used to set the duration mode. See setDurationMode.


AnimationCore Methods:

AnimationCore.getOptimizationModes

description: static, returns the optimization mode. See AnimationCore.setOptimizationModes for more information.

usage: AnimationCore.getOptimizationModes();

returns: String that specifies the tween mode. Either AnimationCore.INTERVAL or AnimationCore.FRAMES.

AnimationCore.setOptimizationModes

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 each IAnimatable class offers an instance method named setOptimizationMode (without the "s") that allows you to remove parts only of the animation instance that don't change during the animation.

usage:

AnimationCore.setOptimizationModes(optimize);

parameters:

returns: Void.

AnimationCore.getTweenModes

description: static, returns the current tween mode, which is applied . if no tween mode is specified to the instance. Please check with AnimationCore.setTweenModes for more information.

usage: AnimationCore.getTweenModes();

returns: String that specifies the tween mode. Either AnimationCore.INTERVAL or AnimationCore.FRAMES.

AnimationCore.setTweenModes

description: static, sets the current tween mode, which is applied . if no tween mode is specified to the instance. The following example shall demonstrate how AnimationCore.setTweenModes works in combination with IAnimatable.setTweenMode available on each IAnimatable instance.

Example 1: Note that the default is tween mode INTERVAL and duration mode MS.

				//change globally to frame based tweening 
				AnimationCore.setTweenModes(AnimationCore.FRAMES);
				
				//tween in 100 frames
				var myScale:Scale = new Scale(mc,150,150); 
				myScale.animationStyle(100, Circ.easeInOut); 
				myScale.animate(0,100);
				
				//override global tween mode with INTERVAL tweening on the IAnimatable instance Move.
				var myMove:Move = new Move(mc2,mc2._x+100,mc2._y); 
				myMove.setTweenMode(AnimationCore.INTERVAL);
				myMove.animationStyle(1000, Circ.easeInOut); 
				myMove.animate(0,100);
				
				//use the global frame based tweening with a local duration mode
				var myRotation:Rotation = new Rotation(mc3,360); 
				myRotation.setDurationMode(AnimationCore.MS);
				myRotation.animationStyle(duration, Circ.easeInOut); 
				myRotation.animate(0,100);
				

usage: AnimationCore.setTweenModes();

parameters:

returns: true if setting tween mode was successful, false if not successful.

AnimationCore.getDurationModes

description: static, returns the current duration mode, which is applied . if no tween mode is specified to the instance.

usage: AnimationCore.getDurationModes();

returns: String that specifies the duration mode. Either AnimationCore.MS or AnimationCore.FRAMES.

AnimationCore.setDurationModes

description: static, sets the current duration mode. Only useful in tween mode AnimationCore.FRAMES. Only then you can set the duration mode from AnimationCore.FRAMES, which is the default, to AnimationCore.MS. This allows you to control animations with milliseconds in tween mode AnimationCore.FRAMES. Please note that AnimationPackage internally still has to convert your specified milliseconds to frames. This is done by guessing the frame rate (fps = frames per second) of your movie. Therefore, controlling animations with milliseconds in tween mode AnimationCore.FRAMES might not be accurate. Since AnimationPackage calculates the fps as soon as you use it for the first time, the example animation below, will start in a one second delay, since this is the time AnimationPackage needs to calculate the fps. Please check with AnimationCore.setTweenModes for more information.

Example 1:

			
					AnimationCore.setTweenModes(AnimationCore.FRAMES);
					AnimationCore.setDurationModes(AnimationCore.MS);
					var myRotation:Rotation = new Rotation(mc);
					myRotation.animationStyle(1500,Sine.easeInOut);
					myRotation.run(360);
					
With APCore.setFPS() you can also set the fps manually. In this case or if you have used any class of AnimationPackage earlier (at least one second), then no start up time is required. See APCore for more information about watching, unwatching, setting and getting your movie's frame rate (fps).

usage: AnimationCore.setDurationModes();

parameters:

returns: true if setting duration mode was successful, false if not successful.

AnimationCore.getOverwriteModes

description: static, see AnimationCore.setOverwriteModes for more information.

usage: AnimationCore.getOverwriteModes();

returns: Boolean

AnimationCore.setOverwriteModes

description: static, Since version 1.07 AnimationPackage by default stops instances, which animate on the same property/method and object. This might come in handy i.e. if you want quickly create button animations as in:

Example 1:

			
					mc.onRollOver = function() {
						var myScale:Scale = new Scale(this,150,150);
						myScale.animationStyle(500, Circ.easeOut);
						myScale.animate(0,100);	
					}
					
					mc.onRollOut = function() {
						var myScale:Scale = new Scale(this,50,50);
						myScale.animationStyle(500, Circ.easeIn);
						myScale.animate(0,100);
					}
					
If one button event triggers a Scale instance and another Scale instance is still animating on the same properties of movieclip mc, the currently animating Scale instance will be stopped. Previously you had to do this yourself to prevent flickering, which requires to hold state of both Scale instances and invoke the stop() method yourself.

In case you don't want this behaviour, set AnimationCore.setOverwriteModes to false.

usage: AnimationCore.setOverwriteModes(overwriteModes);

parameters:

returns: Void.

AnimationCore.pauseAll

description: static, pauses all running animations whether locked or unlocked.

usage: AnimationCore.pauseAll();

returns: Void.

AnimationCore.resumeAll

description: static, resumes all running animations whether locked or unlocked.

usage: AnimationCore.resumeAll();

returns: Void.




generated with AS2docGenerator beta 0.5.3