Skip to content

Commit

Permalink
added Transition Generator.
Browse files Browse the repository at this point in the history
added fades to tween factory
fixed a minor issue with auto-init

git-svn-id: https://kitchensynclib.googlecode.com/svn/trunk@542 6a906af3-0c40-0410-b003-45319c8c72c3
  • Loading branch information
mimshwright committed May 4, 2010
1 parent df7cea5 commit df32267
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/org/as3lib/kitchensync/KitchenSync.as
Expand Up @@ -50,7 +50,12 @@ package org.as3lib.kitchensync
*
* @see org.as3lib.kitchensync.utils.ITimeStringParser
*/
public static function get timeStringParser():ITimeStringParser { return _timeStringParser; }
public static function get timeStringParser():ITimeStringParser {
if (_timeStringParser == null) {
_timeStringParser = KitchenSyncDefaults.timeStringParser;
}
return _timeStringParser;
}
public static function set timeStringParser(timeStringParser:ITimeStringParser):void { _timeStringParser = timeStringParser; }
private static var _timeStringParser:ITimeStringParser;

Expand Down Expand Up @@ -105,7 +110,6 @@ package org.as3lib.kitchensync
synchronizer = Synchronizer.getInstance();
synchronizer.core = synchronizerCore;

timeStringParser = KitchenSyncDefaults.timeStringParser;
_isInitialized = true;
}

Expand Down
28 changes: 28 additions & 0 deletions src/org/as3lib/kitchensync/action/tween/TweenFactory.as
Expand Up @@ -76,6 +76,34 @@ package org.as3lib.kitchensync.action.tween

return new KSTween(tweenTargets, duration, delay, easingFunction, easingMod1, easingMod2);
}

/**
* Creates an alpha tween that fades out.
* The list of parameters are simplified to keep this function short and practical.
*
* @see #newTween()
* @see #newFadeInTween()
*
* @param target Tween's target must be a display object.
* @param duration The time in milliseconds that this tween will take to execute. String values are acceptable too.
*/
public static function newFadeOutTween(target:DisplayObject, duration:* = 0):KSTween {
return newTween(target, "alpha", AUTO_TWEEN_VALUE, 0, duration, 0, Linear.ease);
}

/**
* Creates an alpha tween that fades in.
* The list of parameters are simplified to keep this function short and practical.
*
* @see #newTween()
* @see #newFadeOutTween()
*
* @param target Tween's target must be a display object.
* @param duration The time in milliseconds that this tween will take to execute. String values are acceptable too.
*/
public static function newFadeInTween(target:DisplayObject, duration:* = 0):KSTween {
return newTween(target, "alpha", AUTO_TWEEN_VALUE, 1, duration, 0, Linear.ease);
}

/**
* Creates a tint tween.
Expand Down
15 changes: 15 additions & 0 deletions src/org/as3lib/kitchensync/animation/ITransitionGenerator.as
@@ -0,0 +1,15 @@
package org.as3lib.kitchensync.animation
{
import org.as3lib.kitchensync.action.IAction;

/**
* Creates actions using KitchenSync for show and hide transitions.
* Keep in mind that the transitions are not necessarily started at the time they are requested
* so you shouldn't assume that a generator is shown just because getShowTransition() was called.
*/
public interface ITransitionGenerator
{
function getShowTransition():IAction;
function getHideTransition():IAction;
}
}

0 comments on commit df32267

Please sign in to comment.