From b3d182d7acea180e88c207e3e776e84d91891b5e Mon Sep 17 00:00:00 2001 From: arcnmx Date: Tue, 4 Jun 2024 13:34:00 -0700 Subject: [PATCH 1/3] Fix embedded noteskin filename casing Allows building on systems with case-sensitive filesystems. --- src/game/noteskins/EmbedNoteskin1.as | 2 +- src/game/noteskins/EmbedNoteskin10.as | 2 +- src/game/noteskins/EmbedNoteskin2.as | 2 +- src/game/noteskins/EmbedNoteskin3.as | 2 +- src/game/noteskins/EmbedNoteskin4.as | 2 +- src/game/noteskins/EmbedNoteskin5.as | 2 +- src/game/noteskins/EmbedNoteskin6.as | 2 +- src/game/noteskins/EmbedNoteskin7.as | 2 +- src/game/noteskins/EmbedNoteskin8.as | 2 +- src/game/noteskins/EmbedNoteskin9.as | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/game/noteskins/EmbedNoteskin1.as b/src/game/noteskins/EmbedNoteskin1.as index ccf1a1d6..982dbdca 100644 --- a/src/game/noteskins/EmbedNoteskin1.as +++ b/src/game/noteskins/EmbedNoteskin1.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin1 extends EmbedNoteskinBase { - [Embed(source = "Noteskin1.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin1.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 1; diff --git a/src/game/noteskins/EmbedNoteskin10.as b/src/game/noteskins/EmbedNoteskin10.as index 28e92771..70da7637 100644 --- a/src/game/noteskins/EmbedNoteskin10.as +++ b/src/game/noteskins/EmbedNoteskin10.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin10 extends EmbedNoteskinBase { - [Embed(source = "Noteskin10.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin10.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 10; diff --git a/src/game/noteskins/EmbedNoteskin2.as b/src/game/noteskins/EmbedNoteskin2.as index 30d96063..a4aeea85 100644 --- a/src/game/noteskins/EmbedNoteskin2.as +++ b/src/game/noteskins/EmbedNoteskin2.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin2 extends EmbedNoteskinBase { - [Embed(source = "Noteskin2.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin2.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 2; diff --git a/src/game/noteskins/EmbedNoteskin3.as b/src/game/noteskins/EmbedNoteskin3.as index 4e16ea6d..1daf70b6 100644 --- a/src/game/noteskins/EmbedNoteskin3.as +++ b/src/game/noteskins/EmbedNoteskin3.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin3 extends EmbedNoteskinBase { - [Embed(source = "Noteskin3.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin3.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 3; diff --git a/src/game/noteskins/EmbedNoteskin4.as b/src/game/noteskins/EmbedNoteskin4.as index c61a608e..3f0d8b3d 100644 --- a/src/game/noteskins/EmbedNoteskin4.as +++ b/src/game/noteskins/EmbedNoteskin4.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin4 extends EmbedNoteskinBase { - [Embed(source = "Noteskin4.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin4.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 4; diff --git a/src/game/noteskins/EmbedNoteskin5.as b/src/game/noteskins/EmbedNoteskin5.as index 7b77dfb6..dfdb4d51 100644 --- a/src/game/noteskins/EmbedNoteskin5.as +++ b/src/game/noteskins/EmbedNoteskin5.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin5 extends EmbedNoteskinBase { - [Embed(source = "Noteskin5.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin5.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 5; diff --git a/src/game/noteskins/EmbedNoteskin6.as b/src/game/noteskins/EmbedNoteskin6.as index 0b473928..b6502be9 100644 --- a/src/game/noteskins/EmbedNoteskin6.as +++ b/src/game/noteskins/EmbedNoteskin6.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin6 extends EmbedNoteskinBase { - [Embed(source = "Noteskin6.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin6.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 6; diff --git a/src/game/noteskins/EmbedNoteskin7.as b/src/game/noteskins/EmbedNoteskin7.as index a9623783..e9b054a4 100644 --- a/src/game/noteskins/EmbedNoteskin7.as +++ b/src/game/noteskins/EmbedNoteskin7.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin7 extends EmbedNoteskinBase { - [Embed(source = "Noteskin7.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin7.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 7; diff --git a/src/game/noteskins/EmbedNoteskin8.as b/src/game/noteskins/EmbedNoteskin8.as index ee8441cd..a44e1d2c 100644 --- a/src/game/noteskins/EmbedNoteskin8.as +++ b/src/game/noteskins/EmbedNoteskin8.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin8 extends EmbedNoteskinBase { - [Embed(source = "Noteskin8.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin8.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 8; diff --git a/src/game/noteskins/EmbedNoteskin9.as b/src/game/noteskins/EmbedNoteskin9.as index 2d777e40..52e6723a 100644 --- a/src/game/noteskins/EmbedNoteskin9.as +++ b/src/game/noteskins/EmbedNoteskin9.as @@ -4,7 +4,7 @@ package game.noteskins public class EmbedNoteskin9 extends EmbedNoteskinBase { - [Embed(source = "Noteskin9.swf", mimeType = 'application/octet-stream')] + [Embed(source = "NoteSkin9.swf", mimeType = 'application/octet-stream')] private static const EMBED_SWF:Class; private static const ID:int = 9; From 5aadad2892e66bda0c83b28807d801cf2c0986a6 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Fri, 7 Jun 2024 17:55:44 -0700 Subject: [PATCH 2/3] Fix minor errors when compiling with the Flex SDK --- src/AirContext.as | 2 +- src/classes/Noteskins.as | 2 +- src/classes/User.as | 4 +-- src/classes/chart/parse/ExternalChartBase.as | 2 +- src/classes/mp/MPSocketDataRaw.as | 2 +- src/classes/mp/MPSocketDataText.as | 2 +- src/classes/mp/views/MPRoomViewFFR.as | 38 ++++++++++---------- src/game/GameplayDisplay.as | 4 +-- src/game/results/GameResultFFRScoreList.as | 2 +- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/AirContext.as b/src/AirContext.as index 493e50c9..95a65ffd 100644 --- a/src/AirContext.as +++ b/src/AirContext.as @@ -53,7 +53,7 @@ package public static function createFileName(file_name:String, replace:String = ""):String { // Remove chars not allowed in Windows filename \ / : * ? " < > | - file_name = file_name.replace(/[~\\\/:\*\?"<>\|]/g, replace); + file_name = file_name.replace(/[~\\\/:\*\?\"<>\|]/g, replace); // Trim leading and trailing whitespace. file_name = file_name.replace(/^\s+|\s+$/gs, replace); diff --git a/src/classes/Noteskins.as b/src/classes/Noteskins.as index 0e00d272..dfd4a438 100644 --- a/src/classes/Noteskins.as +++ b/src/classes/Noteskins.as @@ -673,7 +673,7 @@ package classes file = files[i]; try { - if (file.type != ".txt") + if (file.extension != "txt") continue; fileDataJSON = AirContext.readTextFile(file); diff --git a/src/classes/User.as b/src/classes/User.as index 9428e21d..6f45bd1d 100644 --- a/src/classes/User.as +++ b/src/classes/User.as @@ -223,7 +223,7 @@ package classes ///- Determine what songs make up the user's Skill Rating public function getUserSkillRatingData():void { - for (var key:int in this.level_ranks) + for (var key:Object in this.level_ranks) { var levelRank:Object = this.level_ranks[key]; @@ -231,7 +231,7 @@ package classes if (levelRank.score > 0) { //Get the song's difficulty - var songInfo:SongInfo = _playlist.getSongInfo(key); + var songInfo:SongInfo = _playlist.getSongInfo(key as int); if (songInfo == null || songInfo.is_unranked) continue; diff --git a/src/classes/chart/parse/ExternalChartBase.as b/src/classes/chart/parse/ExternalChartBase.as index f70132d9..8f0e1ca3 100644 --- a/src/classes/chart/parse/ExternalChartBase.as +++ b/src/classes/chart/parse/ExternalChartBase.as @@ -48,7 +48,7 @@ package classes.chart.parse return info; } - public function getAudioData():* + public function getAudioData():ByteArray { return AUDIO_BYTES; } diff --git a/src/classes/mp/MPSocketDataRaw.as b/src/classes/mp/MPSocketDataRaw.as index f4f63f6c..7e145566 100644 --- a/src/classes/mp/MPSocketDataRaw.as +++ b/src/classes/mp/MPSocketDataRaw.as @@ -39,7 +39,7 @@ package classes.mp return new MPSocketDataRaw(type, action, data); } } - catch (err) + catch (err:Error) { trace("parseMessage err:", err); } diff --git a/src/classes/mp/MPSocketDataText.as b/src/classes/mp/MPSocketDataText.as index 6539f396..3e066c18 100644 --- a/src/classes/mp/MPSocketDataText.as +++ b/src/classes/mp/MPSocketDataText.as @@ -38,7 +38,7 @@ package classes.mp } } } - catch (err) + catch (err:Error) { trace("parseMessage err:", err); } diff --git a/src/classes/mp/views/MPRoomViewFFR.as b/src/classes/mp/views/MPRoomViewFFR.as index 0e0bf468..86afbafe 100644 --- a/src/classes/mp/views/MPRoomViewFFR.as +++ b/src/classes/mp/views/MPRoomViewFFR.as @@ -704,7 +704,7 @@ internal class UserPanel extends Sprite private var view:MPRoomViewFFR; private var room:MPRoomFFR; - private var name:Text; + private var panelName:Text; private var iconLeaveBtn:UIIcon; private var songName:Text; @@ -720,8 +720,8 @@ internal class UserPanel extends Sprite this.view = view; this.room = room; - name = new Text(this, 20, 0, room.name, 16); - name.setAreaParams(view.width - 85, 30); + panelName = new Text(this, 20, 0, room.name, 16); + panelName.setAreaParams(view.width - 85, 30); iconLeaveBtn = new UIIcon(this, new iconLeave(), view.width - 15, 16); iconLeaveBtn.setSize(15, 15); @@ -752,7 +752,7 @@ internal class UserPanel extends Sprite public function update():void { - name.text = room.name ? room.name : ""; + panelName.text = room.name ? room.name : ""; if (room.songData.selected) { @@ -802,7 +802,7 @@ internal class OwnerPanel extends Sprite private var view:MPRoomViewFFR; private var room:MPRoomFFR; - private var name:Text; + private var panelName:Text; private var iconEditBtn:UIIcon; private var iconLeaveBtn:UIIcon; @@ -821,8 +821,8 @@ internal class OwnerPanel extends Sprite this.view = view; this.room = room; - name = new Text(this, 20, 0, "", 16); - name.setAreaParams(view.width - 85, 30); + panelName = new Text(this, 20, 0, "", 16); + panelName.setAreaParams(view.width - 85, 30); iconEditBtn = new UIIcon(this, new iconGear(), view.width - 45, 16); iconEditBtn.setSize(15, 15); @@ -866,7 +866,7 @@ internal class OwnerPanel extends Sprite public function update():void { - name.text = room.name ? room.name : ""; + panelName.text = room.name ? room.name : ""; if (room.songData.selected) { @@ -930,7 +930,7 @@ internal class OwnerEditPanel extends Sprite private var view:MPRoomViewFFR; private var room:MPRoomFFR; - private var name:BoxText; + private var panelName:BoxText; private var iconCancelBtn:UIIcon; private var iconSaveBtn:UIIcon; @@ -953,10 +953,10 @@ internal class OwnerEditPanel extends Sprite this.view = view; this.room = room; - name = new BoxText(this, 20, 1, 280, 28); - name.field.y += 1; - name.borderAlpha = 0; - name.borderActiveAlpha = 0; + panelName = new BoxText(this, 20, 1, 280, 28); + panelName.field.y += 1; + panelName.borderAlpha = 0; + panelName.borderActiveAlpha = 0; iconCancelBtn = new UIIcon(this, new iconCancel(), view.width - 45, 16); iconCancelBtn.setSize(15, 15); @@ -1031,17 +1031,17 @@ internal class OwnerEditPanel extends Sprite // Draw this.graphics.lineStyle(1, 0xFFFFFF, 0.35); - this.graphics.moveTo(name.x, 1); - this.graphics.lineTo(name.x, name.height + 1); - this.graphics.moveTo(name.x + name.width, 1); - this.graphics.lineTo(name.x + name.width, name.height + 1); + this.graphics.moveTo(panelName.x, 1); + this.graphics.lineTo(panelName.x, panelName.height + 1); + this.graphics.moveTo(panelName.x + panelName.width, 1); + this.graphics.lineTo(panelName.x + panelName.width, panelName.height + 1); update(); } public function update():void { - name.text = room.name ? room.name : ""; + panelName.text = room.name ? room.name : ""; roomPassword.text = room.password ? room.password : ""; joinCode.text = room.joinCode ? room.joinCode : ""; @@ -1082,7 +1082,7 @@ internal class OwnerEditPanel extends Sprite _mp.addEventListener(MPEvent.ROOM_EDIT_FAIL, e_onEditFail); const cmd:MPCRoomEdit = new MPCRoomEdit(room); - cmd.name = name.text; + cmd.name = panelName.text; cmd.password = roomPassword.text; // FFA diff --git a/src/game/GameplayDisplay.as b/src/game/GameplayDisplay.as index d1e735b7..2a0df412 100644 --- a/src/game/GameplayDisplay.as +++ b/src/game/GameplayDisplay.as @@ -2437,7 +2437,7 @@ internal class EditorMenu extends Sprite gameplay.interfaceSetup(); } - function e_setLayoutSingle(e:MouseEvent):void + private function e_setLayoutSingle(e:MouseEvent):void { var layout:Object = gameplay.options.layout; @@ -2447,7 +2447,7 @@ internal class EditorMenu extends Sprite gameplay.interfaceSetup(); } - function e_setLayoutMulti(e:MouseEvent):void + private function e_setLayoutMulti(e:MouseEvent):void { var layout:Object = gameplay.options.layout; diff --git a/src/game/results/GameResultFFRScoreList.as b/src/game/results/GameResultFFRScoreList.as index 726829f8..4d4fe78a 100644 --- a/src/game/results/GameResultFFRScoreList.as +++ b/src/game/results/GameResultFFRScoreList.as @@ -144,7 +144,7 @@ package game.results private function e_onPaneClick(e:MouseEvent):void { - if (!handler) + if (handler == null) return; if (e.target is UserLabel) From 6af39c22cb2c5fe5978cc6c036f0d56017a08ac9 Mon Sep 17 00:00:00 2001 From: arcnmx Date: Sat, 6 Jul 2024 12:57:24 -0700 Subject: [PATCH 3/3] Remove unused greensock `CirclePath2DPlugin` It depends on `com.greensock.motionPaths`, which was removed from the source tree in d86da83d460b3661428ffcec521c8f736778acce --- src/com/greensock/data/TweenLiteVars.as | 1204 --------------- src/com/greensock/data/TweenMaxVars.as | 1285 ----------------- .../greensock/plugins/CirclePath2DPlugin.as | 132 -- 3 files changed, 2621 deletions(-) delete mode 100644 src/com/greensock/data/TweenLiteVars.as delete mode 100644 src/com/greensock/data/TweenMaxVars.as delete mode 100644 src/com/greensock/plugins/CirclePath2DPlugin.as diff --git a/src/com/greensock/data/TweenLiteVars.as b/src/com/greensock/data/TweenLiteVars.as deleted file mode 100644 index 9405159c..00000000 --- a/src/com/greensock/data/TweenLiteVars.as +++ /dev/null @@ -1,1204 +0,0 @@ -/** - * VERSION: 12.01 - * DATE: 2012-09-10 - * AS3 - * UPDATES AND DOCS AT: http://www.greensock.com/tweenvars/ - **/ -package com.greensock.data { - import com.greensock.TweenLite; - import com.greensock.motionPaths.MotionPath; - - import flash.display.Stage; - import flash.geom.Point; -/** - * [AS3 only] There are 3 primary benefits of using a TweenLiteVars instance to define your TweenLite's "vars" parameter: - *
    - *
  1. In most code editors, code hinting will be activated which helps remind you which special properties are available.
  2. - *
  3. It allows you to code using strict data typing which can improve debugging.
  4. - *
  5. It will trace() a warning if you forgot to activate a particular plugin. For example, if you define an autoAlpha value in a TweenLiteVars instance but you didn't activate() the plugin, you'll see a trace() output when you test/compile the file (an Error isn't thrown because in some very rare circumstances it can be perfectly legitimate to avoid activating the plugin)
  6. - *
- * - *

The down side, of course, is that the code is more verbose and TweenLiteVars adds about 5kb to your published swf.

- * - *

USAGE:

- *

Note that each method returns the TweenLiteVars object, so you can reduce the lines of code by method chaining (see example below).

- * - *

Without TweenLiteVars:

- *

TweenLite.to(mc, 1, {x:300, y:100, tint:0xFF0000, onComplete:myFunction, onCompleteParams:[mc]})

- * - *

With TweenLiteVars

- *

TweenLite.to(mc, 1, new TweenLiteVars().move(300, 100).tint(0xFF0000).onComplete(myFunction, [mc]));

- * - *

You can use the prop() method to set individual generic properties (like "myCustomProperty" or "rotationY") or you can - * pass a generic Object into the constructor to make it a bit more concise, like this:

- * - *

TweenLite.to(mc, 1, new TweenLiteVars({myCustomProperty:300, rotationY:100}).tint(0xFF0000).onComplete(myFunction, [mc]));

- * - *

NOTES:

- *
    - *
  • To get the generic vars object that TweenLiteVars builds internally, simply access its "vars" property. - * In fact, if you want maximum backwards compatibility, you can tack ".vars" onto the end of your chain like this: - * TweenLite.to(mc, 1, new TweenLiteVars({x:300, y:100}).tint(0xFF0000).onComplete(myFunction, [mc]).vars);
  • - *
  • This class adds about 6kb to your published SWF (not including TweenLite or any plugins).
  • - *
  • Using TweenLiteVars is completely optional. If you prefer the shorter generic object synatax, feel - * free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict datatyping.
  • - *
- * - *

Copyright 2008-2014, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for Club GreenSock members, the software agreement that was issued with the membership.

- * - * @author Jack Doyle, jack@greensock.com - */ - public class TweenLiteVars { - /** @private **/ - public static const version:Number = 12.0; - - /** @private **/ - protected var _vars:Object; - - /** - * Constructor - * @param vars A generic Object containing properties that you'd like added (copied) to this TweenLiteVars instance. This is particularly useful for generic properties that don't have a corresponding method for setting the values (although you can use it for properties that do have corresponding methods too). For example, to tween the x and y properties of a DisplayObject, new TweenLiteVars({x:300, y:0}) - */ - public function TweenLiteVars(vars:Object=null) { - _vars = {}; - if (vars != null) { - for (var p:String in vars) { - _vars[p] = vars[p]; - } - } - } - - /** @private **/ - protected function _set(property:String, value:*, requirePlugin:Boolean=false):TweenLiteVars { - if (value == null) { - delete _vars[property]; //in case it was previously set - } else { - _vars[property] = value; - } - if (requirePlugin && !(property in TweenLite._plugins)) { - trace("WARNING: you must activate() the " + property + " plugin in order for the feature to work in TweenLite. See http://www.greensock.com/tweenlite/#plugins for details."); - } - return this; - } - - /** - * Adds a dynamic property for tweening and allows you to indicate whether the value is relative or not. - * For example, to tween "x" to 50 less than whatever it currently is: - * - *

prop("x", -50, true);

- * - * @param property Property name - * @param value Numeric end value (or beginning value for from() tweens) - * @param relative If true, the value will be interpreted as relative to the target's current value. For example, if mc.x is currently 300 and you do prop("x", 200, true), the end value will be 500. - */ - public function prop(property:String, value:Number, relative:Boolean=false):TweenLiteVars { - return _set(property, (!relative) ? value : (value < 0) ? "-=" + (-value) : "+=" + value); - } - - -//---- BUILT-IN SPECIAL PROPERTIES (NO PLUGIN ACTIVATION REQUIRED) -------------------------------------------------------------- - - /** Any generic data that you'd like associated with your tween. **/ - public function data(data:*):TweenLiteVars { - return _set("data", data); - } - - /** The number of seconds (or frames for frames-based tweens) to delay before the tween begins. **/ - public function delay(delay:Number):TweenLiteVars { - return _set("delay", delay); - } - - /** - * Controls the rate of change. Use any standard easing equation like ElasticOut.ease. The Default is QuadOut.ease. - * - * @param ease An ease (i.e. com.greensock.easing.ElasticOut.ease) The default is QuadOut.ease. - * @param easeParams An Array of extra parameter values to feed the easing equation (beyond the standard 4). This can be useful with easing equations like Elastic that accept extra parameters like the amplitude and period. Most easing equations, however, don't accept extra parameters so you won't need to pass in any easeParams. - **/ - public function ease(ease:*, easeParams:Array=null):TweenLiteVars { - _set("easeParams", easeParams); - return _set("ease", ease); - } - - /** - * Normally when you create a tween, it begins rendering on the very next frame (when - * the Flash Player dispatches an ENTER_FRAME event) unless you specify a delay. - * This allows you to insert tweens into timelines and perform other actions that may affect - * its timing. However, if you prefer to force the tween to render immediately when it is - * created, set immediateRender to true. from() tweens - * render immediately by default, so to prevent that behavior, set immediateRender - * to false. - **/ - public function immediateRender(value:Boolean):TweenLiteVars { - return _set("immediateRender", value, false); - } - - /** - * A function that should be called when the tween has completed. - * - * @param func A function that should be called when the tween has completed. - * @param params An Array of parameters to pass the onComplete function - **/ - public function onComplete(func:Function, params:Array=null):TweenLiteVars { - _set("onCompleteParams", params); - return _set("onComplete", func); - } - - /** - * A function that should be called after the tween has completed and rendered its final state to the stage (waits for the next ENTER_FRAME event is dispatched after the tween finishes). Target must be a DisplayObject. - * - * @param func A function that should be called after the tween has completed and rendered its final state to the stage (waits for the next ENTER_FRAME event is dispatched after the tween finishes). - * @param params An Array of parameters to pass the onCompleteRender function - **/ - public function onCompleteRender(func:Function, params:Array=null):TweenLiteVars { - _set("onCompleteRenderParams", params); - return _set("onCompleteRender", func, true); - } - - /** - * A function that should be called when the tween begins (when its time() is at 0 - * and changes to some other value which can happen more than once if the tween is restarted multiple times). - * - * @param func A function that should be called when the tween begins. - * @param params An Array of parameters to pass the onStart function. - **/ - public function onStart(func:Function, params:Array=null):TweenLiteVars { - _set("onStartParams", params); - return _set("onStart", func); - } - - /** - * A function to call whenever the tweening values are updated (on every frame during the time the tween is active). - * - * @param func A function to call whenever the tweening values are updated. - * @param params An Array of parameters to pass the onUpdate function - **/ - public function onUpdate(func:Function, params:Array=null):TweenLiteVars { - _set("onUpdateParams", params); - return _set("onUpdate", func); - } - - /** - * A function that should be called when the tween has reached its starting point again after having been reversed. - * - * @param func A function that should be called when the tween has reached its starting point again after having been reversed. - * @param params An Array of parameters to pass the onReverseComplete function - **/ - public function onReverseComplete(func:Function, params:Array=null):TweenLiteVars { - _set("onReverseCompleteParams", params); - return _set("onReverseComplete", func); - } - - /** - * Controls how (and if) other tweens of the same target are overwritten. - * There are several modes to choose from, but "auto" is the default (although - * you can change the default mode using the TweenLite.defaultOverwrite property): - *
    - *
  • "none" - no overwriting will occur.
  • - * - *
  • "all" - immediately overwrites all existing - * tweens of the same target even if they haven't started yet or don't have - * conflicting properties.
  • - * - *
  • "auto" - when the tween renders for the first time, it will analyze - * tweens of the same target that are currently active/running and only overwrite - * individual tweening properties that overlap/conflict. Tweens that haven't begun - * yet are ignored. For example, if another active tween is found that is tweening - * 3 properties, only 1 of which it shares in common with the new tween, the other - * 2 properties will be left alone. Only the conflicting property gets overwritten/killed. - * This is the default mode and typically the most intuitive for developers.
  • - * - *
  • "concurrent" - when the tween renders for the first time, it kills - * only the active (in-progress) tweens of the same target regardless of whether - * or not they contain conflicting properties. Like a mix of "all" - * and "auto". Good for situations where you only want one tween - * controling the target at a time.
  • - * - *
  • "allOnStart" - Identical to "all" but waits to run - * the overwrite logic until the tween begins (after any delay). Kills - * tweens of the same target even if they don't contain conflicting properties - * or haven't started yet.
  • - * - *
  • "preexisting" - when the tween renders for the first time, it kills - * only the tweens of the same target that existed BEFORE this tween was created - * regardless of their scheduled start times. So, for example, if you create a tween - * with a delay of 10 and then a tween with a delay of 1 and then a tween with a - * delay of 2 (all of the same target), the 2nd tween would overwrite the first - * but not the second even though scheduling might seem to dictate otherwise. - * "preexisting" only cares about the order in which the instances - * were actually created. This can be useful when the order in which your code runs - * plays a critical role.
  • - *
- **/ - public function overwrite(value:String):TweenLiteVars { - return _set("overwrite", value, false); - } - - /** Controls the paused state of the tween - if true, the tween will be paused initially. **/ - public function paused(value:Boolean):TweenLiteVars { - return _set("paused", value, false); - } - - /** When true, the tween will flip the start and end values which is exactly what TweenLite.from() does. **/ - public function runBackwards(value:Boolean):TweenLiteVars { - return _set("runBackwards", value, false); - } - - /** - * If useFrames is set to true, the tweens's timing mode will be based on frames. - * Otherwise, it will be based on seconds/time. NOTE: a tween's timing mode is always - * determined by its parent timeline. - **/ - public function useFrames(value:Boolean):TweenLiteVars { - return _set("useFrames", value, false); - } - - -//---- COMMON CONVENIENCE PROPERTIES (NO PLUGIN REQUIRED) ------------------------------------------------------------------- - - /** Tweens the "x" and "y" properties of the target **/ - public function move(x:Number, y:Number, relative:Boolean=false):TweenLiteVars { - prop("x", x, relative); - return prop("y", y, relative); - } - - /** Tweens the "scaleX" and "scaleY" properties of the target **/ - public function scale(value:Number, relative:Boolean=false):TweenLiteVars { - prop("scaleX", value, relative); - return prop("scaleY", value, relative); - } - - /** Tweens the "rotation" property of the target **/ - public function rotation(value:Number, relative:Boolean=false):TweenLiteVars { - return prop("rotation", value, relative); - } - - /** Tweens the "scaleX" property of the target **/ - public function scaleX(value:Number, relative:Boolean=false):TweenLiteVars { - return prop("scaleX", value, relative); - } - - /** Tweens the "scaleY" property of the target **/ - public function scaleY(value:Number, relative:Boolean=false):TweenLiteVars { - return prop("scaleY", value, relative); - } - - /** Tweens the "width" property of the target **/ - public function width(value:Number, relative:Boolean=false):TweenLiteVars { - return prop("width", value, relative); - } - - /** Tweens the "height" property of the target **/ - public function height(value:Number, relative:Boolean=false):TweenLiteVars { - return prop("height", value, relative); - } - - /** Tweens the "x" property of the target **/ - public function x(value:Number, relative:Boolean=false):TweenLiteVars { - return prop("x", value, relative); - } - - /** Tweens the "y" property of the target **/ - public function y(value:Number, relative:Boolean=false):TweenLiteVars { - return prop("y", value, relative); - } - - -//---- PLUGIN REQUIRED ------------------------------------------------------------------------------------------- - - /** Same as changing the "alpha" property but with the additional feature of toggling the "visible" property to false whenever alpha is 0, thus improving rendering performance in the Flash Player. **/ - public function autoAlpha(alpha:Number):TweenLiteVars { - return _set("autoAlpha", alpha, true); - } - - /** - * Tweens a BevelFilter - * - * @param distance The offset distance of the bevel. - * @param angle The angle of the bevel. - * @param highlightColor The highlight color of the bevel. - * @param highlightAlpha The alpha transparency value of the highlight color. - * @param shadowColor The shadow color of the bevel. - * @param shadowAlpha The alpha transparency value of the shadow color. - * @param blurX The amount of horizontal blur, in pixels. - * @param blurY The amount of vertical blur, in pixels. - * @param strength The strength of the imprint or spread. - * @param quality The number of times to apply the filter. - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new BevelFilter will be added to the target even if a BevelFilter is already in its filters array. - * @param index Allows you to target a particular BevelFilter if there are multiple BevelFilters in the target's filters array - simply define the index value corresponding to the BevelFilter's position in the filters array. - * @return The TweenLiteVars instance - */ - public function bevelFilter(distance:Number=4, angle:Number=45, highlightColor:uint=0xFFFFFF, highlightAlpha:Number=0.5, shadowColor:uint=0x000000, shadowAlpha:Number=0.5, blurX:Number=4, blurY:Number=4, strength:Number=1, quality:int=2, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenLiteVars { - var filter:Object = {distance:distance, angle:angle, highlightColor:highlightColor, highlightAlpha:highlightAlpha, shadowColor:shadowColor, shadowAlpha:shadowAlpha, blurX:blurX, blurY:blurY, strength:strength, quality:quality, addFilter:addFilter, remove:remove}; - if (index > -1) { - filter.index = index; - } - return _set("bevelFilter", filter, true); - } - - /** - * Bezier tweening allows you to tween in a non-linear way. For example, you may want to tween - * a MovieClip's position from the origin (0,0) 500 pixels to the right (500,0) but curve downwards - * through the middle of the tween. Simply pass as many objects in the bezier Array as you'd like, - * one for each "control point" (see documentation on Flash's curveTo() drawing method for more - * about how control points work). - * - *

Keep in mind that you can bezier tween ANY properties, not just x/y.

- * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.BezierPlugin; -TweenPlugin.activate([BezierPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 3, new TweenLiteVars().bezier([{x:250, y:50}, {x:500, y:0}])); //makes my_mc travel through 250,50 and end up at 500,0. - - * - * @param values An array of objects with key/value pairs that define the bezier points like [{x:250, y:50}, {x:500, y:0}] - * @see #bezierThrough() - **/ - public function bezier(values:Array):TweenLiteVars { - return _set("bezier", values, true); - } - - /** - * Identical to bezier except that instead of passing Bezier control point values, you pass values through - * which the Bezier values should move. This can be more intuitive than using control points. - * - * @param values An array of objects with key/value pairs that define the bezier points like [{x:250, y:50}, {x:500, y:0}] - * @see #bezier() - **/ - public function bezierThrough(values:Array):TweenLiteVars { - return _set("bezierThrough", values, true); - } - - /** - * Tweens a BlurFilter - * - * @param blurX The amount of horizontal blur. - * @param blurY The amount of vertical blur. - * @param quality The number of times to perform the blur. - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new BlurFilter will be added to the target even if a BlurFilter is already in its filters array. - * @param index Allows you to target a particular BlurFilter if there are multiple BlurFilters in the target's filters array - simply define the index value corresponding to the BlurFilter's position in the filters array. - * @return The TweenLiteVars instance - */ - public function blurFilter(blurX:Number, blurY:Number, quality:int=2, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenLiteVars { - var filter:Object = {blurX:blurX, blurY:blurY, quality:quality, addFilter:addFilter, remove:remove}; - if (index > -1) { - filter.index = index; - } - return _set("blurFilter", filter, true); - } - - /** - * Tweens an object along a CirclePath2D motion path in any direction (clockwise, counter-clockwise, or shortest). - * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.~~; -import com.greensock.motionPaths.~~ -TweenPlugin.activate([CirclePath2DPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -var circle:CirclePath2D = new CirclePath2D(150, 150, 100); -TweenLite.to(mc, 2, new TweenLiteVars().circlePath2D(circle, 90, 270, false, Direction.CLOCKWISE, 2)); - - * - * @param path The CirclePath2D instance to follow (com.greensock.motionPaths.CirclePath2D) - * @param startAngle The position at which the target should begin its rotation (described in degrees unless useRadians is true in which case it is described in radians). For example, to begin at the top of the circle, use 270 or -90 as the startAngle. - * @param endAngle The position at which the target should end its rotation (described in degrees unless useRadians is true in which case it is described in radians). For example, to end at the bottom of the circle, use 90 as the endAngle. - * @param autoRotate When autoRotate is true, the target will automatically be rotated so that it is oriented to the angle of the path. To offset this value (like to always add 90 degrees for example), use the rotationOffset property. - * @param direction The direction in which the target should travel around the path. Options are Direction.CLOCKWISE ("clockwise"), Direction.COUNTER_CLOCKWISE ("counterClockwise"), or Direction.SHORTEST ("shortest"). - * @param extraRevolutions If instead of going directly to the endAngle, you want the target to travel one or more extra revolutions around the path before going to the endAngle, define that number of revolutions here. - * @param rotationOffset When autoRotate is true, this value will always be added to the resulting rotation of the target. - * @param useRadians If you prefer to define values in radians instead of degrees, set useRadians to true. - * @return The TweenLiteVars instance - */ - public function circlePath2D(path:MotionPath, startAngle:Number, endAngle:Number, autoRotate:Boolean=false, direction:String="clockwise", extraRevolutions:uint=0, rotationOffset:Number=0, useRadians:Boolean=false):TweenLiteVars { - return _set("circlePath2D", {path:path, startAngle:startAngle, endAngle:endAngle, autoRotate:autoRotate, direction:direction, extraRevolutions:extraRevolutions, rotationOffset:rotationOffset, useRadians:useRadians}, true); - } - - /** - * ColorMatrixFilter tweening offers an easy way to tween a DisplayObject's saturation, hue, contrast, - * brightness, and colorization. - * - *

HINT: If you'd like to match the ColorMatrixFilter values you created in the Flash IDE on a particular object, - * you can get its matrix like this:

- * - * -import flash.display.DisplayObject; -import flash.filters.ColorMatrixFilter; - -function getColorMatrix(mc:DisplayObject):Array { - var f:Array = mc.filters, i:uint; - for (i = 0; i < f.length; i++) { - if (f[i] is ColorMatrixFilter) { - return f[i].matrix; - } - } - return null; -} - -var myOriginalMatrix:Array = getColorMatrix(my_mc); //store it so you can tween back to it anytime - - * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.ColorMatrixFilterPlugin; -TweenPlugin.activate([ColorMatrixFilterPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 1, new TweenLiteVars().colorMatrixFilter(0xFF0000)); - - * - * @param colorize The color to use for the colorizing effect - colorizing a DisplayObject makes it look as though you're seeing it through a colored piece of glass whereas tinting it makes every pixel exactly that color. You can control the amount of colorization using the "amount" parameter where 1 is full strength, 0.5 is half-strength, and 0 has no colorization effect. - * @param amount A number between 0 and 1 that determines the potency of the colorize effect. This parameter is ignored if the colorize parameter is left at its default value of 0xFFFFFF. - * @param saturation A number indicating the saturation where 1 is normal saturation, 0 makes the target look grayscale, and 2 would be double the normal saturation. - * @param contrast A number indicating the contrast where 1 is normal contrast, 0 is no contrast, and 2 is double the normal contrast, etc. - * @param brightness A number indicating the brightness where 1 is normal brightness, 0 is much darker than normal, and 2 is twice the normal brightness, etc. - * @param hue An angle-like number between 0 and 360 indicating the change in hue. Think of it as degrees, so 180 would be rotating the hue to be exactly opposite as normal, 360 would be the same as 0, etc. - * @param threshold A number from 0 to 255 that controls the threshold of where the pixels turn white or black (leave as -1 to avoid any threshold effect whatsoever). - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new ColorMatrixFilter will be added to the target even if a ColorMatrixFilter is already in its filters array. - * @param index Allows you to target a particular ColorMatrixFilter if there are multiple ColorMatrixFilters in the target's filters array - simply define the index value corresponding to the ColorMatrixFilter's position in the filters array. - * @return The TweenLiteVars instance - */ - public function colorMatrixFilter(colorize:uint=0xFFFFFF, amount:Number=1, saturation:Number=1, contrast:Number=1, brightness:Number=1, hue:Number=0, threshold:Number=-1, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenLiteVars { - var filter:Object = {saturation:saturation, contrast:contrast, brightness:brightness, hue:hue, addFilter:addFilter, remove:remove}; - if (colorize != 0xFFFFFF) { - filter.colorize = colorize; - filter.amount = amount; - } - if (threshold > -1) { - filter.threshold = threshold; - } - if (index > -1) { - filter.index = index; - } - return _set("colorMatrixFilter", filter, true); - } - - /** - * Tweens ColorTransform properties of a DisplayObject to do advanced effects like overexposing, altering - * the brightness or setting the percent/amount of tint. - * - * @param tint The color value for a ColorTransform object. - * @param tintAmount A numeric value between 0 and 1 indicating the potency of the tint. For example, if tint is 0xFF0000 and tintAmount is 0.5, the target would be tinted halfway to red. - * @param exposure A numeric value between 0 and 2 where 1 is normal exposure, 0, is completely underexposed, and 2 is completely overexposed. Overexposing an object is different then changing the brightness - it seems to almost bleach the image and looks more dynamic and interesting (subjectively speaking). - * @param brightness A numeric value between 0 and 2 where 1 is normal brightness, 0 is completely dark/black, and 2 is completely bright/white - * @param redMultiplier A decimal value that is multiplied with the red channel value. - * @param greenMultiplier A decimal value that is multiplied with the green channel value. - * @param blueMultiplier A decimal value that is multiplied with the blue channel value. - * @param alphaMultiplier A decimal value that is multiplied with the alpha transparency channel value. - * @param redOffset A number from -255 to 255 that is added to the red channel value after it has been multiplied by the redMultiplier value. - * @param greenOffset A number from -255 to 255 that is added to the green channel value after it has been multiplied by the greenMultiplier value. - * @param blueOffset A number from -255 to 255 that is added to the blue channel value after it has been multiplied by the blueMultiplier value. - * @param alphaOffset A number from -255 to 255 that is added to the alpha transparency channel value after it has been multiplied by the alphaMultiplier value. - * @return The TweenLiteVars instance - */ - public function colorTransform(tint:Number=NaN, tintAmount:Number=NaN, exposure:Number=NaN, brightness:Number=NaN, redMultiplier:Number=NaN, greenMultiplier:Number=NaN, blueMultiplier:Number=NaN, alphaMultiplier:Number=NaN, redOffset:Number=NaN, greenOffset:Number=NaN, blueOffset:Number=NaN, alphaOffset:Number=NaN):TweenLiteVars { - var values:Object = {tint:tint, tintAmount:isNaN(tint) ? NaN : tintAmount, exposure:exposure, brightness:brightness, redMultiplier:redMultiplier, greenMultiplier:greenMultiplier, blueMultiplier:blueMultiplier, alphaMultiplier:alphaMultiplier, redOffset:redOffset, greenOffset:greenOffset, blueOffset:blueOffset, alphaOffset:alphaOffset}; - for (var p:String in values) { - if (isNaN(values[p])) { - delete values[p]; - } - } - return _set("colorTransform", values, true); - } - - /** - * Tweens a DropShadowFilter. - * - * @param distance The offset distance for the shadow, in pixels. - * @param blurX The amount of horizontal blur. - * @param blurY The amount of vertical blur. - * @param alpha The alpha transparency value for the shadow color. - * @param angle The angle of the shadow. - * @param color The color of the shadow. - * @param strength The strength of the imprint or spread. - * @param inner Indicates whether or not the shadow is an inner shadow. - * @param knockout Applies a knockout effect (true), which effectively makes the object's fill transparent and reveals the background color of the document. - * @param hideObject Indicates whether or not the object is hidden. - * @param quality The number of times to apply the filter. - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new DropShadowFilter will be added to the target even if a DropShadowFilter is already in its filters array. - * @param index Allows you to target a particular DropShadowFilter if there are multiple DropShadowFilters in the target's filters array - simply define the index value corresponding to the DropShadowFilter's position in the filters array. - * @return The TweenLiteVars instance - */ - public function dropShadowFilter(distance:Number=4, blurX:Number=4, blurY:Number=4, alpha:Number=1, angle:Number=45, color:uint=0x000000, strength:Number=2, inner:Boolean=false, knockout:Boolean=false, hideObject:Boolean=false, quality:uint=2, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenLiteVars { - var filter:Object = {distance:distance, blurX:blurX, blurY:blurY, alpha:alpha, angle:angle, color:color, strength:strength, inner:inner, knockout:knockout, hideObject:hideObject, quality:quality, addFilter:addFilter, remove:remove}; - if (index > -1) { - filter.index = index; - } - return _set("dropShadowFilter", filter, true); - } - - /** - * If you'd like to tween something to a destination value that may change at any time, - * dynamicProps allows you to simply associate a function with a property so that - * every time the tween is rendered, it calls that function to get the new destination value - * for the associated property. For example, if you want a MovieClip to tween to wherever the - * mouse happens to be, you could do: - * - * -TweenLite.to(mc, 3, new TweenLiteVars().dynamicProps({x:getMouseX, y:getMouseY})); -function getMouseX():Number { - return this.mouseX; -} -function getMouseY():Number { - return this.mouseY; -} - - * - *

Of course you can get as complex as you want inside your custom function, as long as - * it returns the destination value, TweenLite/Max will take care of adjusting things - * on the fly.

- * - *

You can optionally pass any number of parameters to functions using the "params" - * parameter like so:

- * - * -TweenLite.to(mc, 3, new TweenLiteVars().dynamicProps({x:myFunction, y:myFunction}, {x:[mc2, "x"], y:[mc2, "y"]})); -function myFunction(object:MovieClip, propName:String):Number { - return object[propName]; -} - - * - *

DynamicPropsPlugin is a Club GreenSock membership benefit. - * You must have a valid membership to use this class without violating the terms of use. - * Visit http://www.greensock.com/club/ to sign up or get - * more details.

- * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.~~; -TweenPlugin.activate([DynamicPropsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(my_mc, 3, new TweenLiteVars().dynamicProps({x:getMouseX, y:getMouseY})); - -function getMouseX():Number { - return this.mouseX; -} -function getMouseY():Number { - return this.mouseY; -} - - * @param props An object containing properties that are named cooresponding to the properties of the target that should be affected, and the value should point to the function that handles returning the appropriate value, like {x:getMouseX, y:getMouseY}. - * @param params An object containing properties that are named corresponding to the properties of the target that should be affected, and the value should be an array of parameters that are passed to the corresponding function, like {x:[mc, "param2"], y:[mc, "param2"]} - * @return self - **/ - public function dynamicProps(props:Object, params:Object=null):TweenLiteVars { - if (params != null) { - props.params = params; - } - return _set("dynamicProps", props, true); - } - - /** An Array containing numeric end values of the target Array. Keep in mind that the target of the tween must be an Array with at least the same length as the endArray. **/ - public function endArray(values:Array):TweenLiteVars { - return _set("endArray", values, true); - } - - /** - * Tweens a MovieClip to a particular frame. - * - *

USAGE:

- * - * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.FramePlugin; -TweenPlugin.activate([FramePlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 1, new TweenLiteVars().frame(125)); - - * - *

Note: When tweening the frames of a MovieClip, any audio that is embedded on the MovieClip's timeline - * (as "stream") will not be played. Doing so would be impossible because the tween might speed up or slow - * down the MovieClip to any degree.

- * - * @param value The frame to which the MovieClip should be tweened (or if relative is true, this value would represent the number of frames to travel from the current frame) - * @param relative If true, the frame value will be interpreted as relative to the current frame. So for example, if the MovieClip is at frame 5 currently and frame(10, true) is used, the MovieClip will tween 10 frames and end up on frame 15. - **/ - public function frame(value:int, relative:Boolean=false):TweenLiteVars { - return _set("frame", (relative) ? String(value) : value, true); - } - - /** - * Tweens a MovieClip backward to a particular frame number, wrapping it if/when it reaches the beginning - * of the timeline. For example, if your MovieClip has 20 frames total and it is currently at frame 10 - * and you want tween to frame 15, a normal frame tween would go forward from 10 to 15, but a frameBackward - * would go from 10 to 1 (the beginning) and wrap to the end and continue tweening from 20 to 15. - **/ - public function frameBackward(frame:int):TweenLiteVars { - return _set("frameBackward", frame, true); - } - - /** - * Tweens a MovieClip forward to a particular frame number, wrapping it if/when it reaches the end - * of the timeline. For example, if your MovieClip has 20 frames total and it is currently at frame 10 - * and you want tween to frame 5, a normal frame tween would go backwards from 10 to 5, but a frameForward - * would go from 10 to 20 (the end) and wrap to the beginning and continue tweening from 1 to 5. - **/ - public function frameForward(frame:int):TweenLiteVars { - return _set("frameForward", frame, true); - } - - /** Tweens a MovieClip to a particular frame. **/ - public function frameLabel(label:String):TweenLiteVars { - return _set("frameLabel", label, true); - } - - - /** - * Tweens a GlowFilter - * - * @param blurX The amount of horizontal blur. - * @param blurY The amount of vertical blur. - * @param color The color of the glow. - * @param alpha The alpha transparency value for the color. - * @param strength The strength of the imprint or spread. - * @param inner Specifies whether the glow is an inner glow. - * @param knockout Specifies whether the object has a knockout effect. - * @param quality The number of times to apply the filter. - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new GlowFilter will be added to the target even if a GlowFilter is already in its filters array. - * @param index Allows you to target a particular GlowFilter if there are multiple GlowFilters in the target's filters array - simply define the index value corresponding to the GlowFilter's position in the filters array. - * @return The TweenLiteVars instance - */ - public function glowFilter(blurX:Number=10, blurY:Number=10, color:uint=0xFFFFFF, alpha:Number=1, strength:Number=2, inner:Boolean=false, knockout:Boolean=false, quality:uint=2, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenLiteVars { - var filter:Object = {blurX:blurX, blurY:blurY, color:color, alpha:alpha, strength:strength, inner:inner, knockout:knockout, quality:quality, addFilter:addFilter, remove:remove}; - if (index > -1) { - filter.index = index; - } - return _set("glowFilter", filter, true); - } - - /** - * Although hex colors are technically numbers, if you try to tween them conventionally, - * you'll notice that they don't tween smoothly. To tween them properly, the red, green, and - * blue components must be extracted and tweened independently. The HexColorsPlugin makes it easy. - * To tween a property of your object that's a hex color to another hex color, just pass a hexColors - * Object with properties named the same as your object's hex color properties. For example, - * if myObject has a "myHexColor" property that you'd like to tween to red (0xFF0000) over the - * course of 2 seconds, you'd do: - * - *

- * TweenMax.to(myObject, 2, new TweenLiteVars().hexColors({myHexColor:0xFF0000})); - *

- * - *

You can pass in any number of hexColor properties.

- * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.HexColorsPlugin; -TweenPlugin.activate([HexColorsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(myObject, 2, new TweenLiteVars().hexColors({myHexColor:0xFF0000})); - - *

Or if you just want to tween a color and apply it somewhere on every frame, you could do:

- * -var myColor:Object = {hex:0xFF0000}; -TweenLite.to(myColor, 2, new TweenLiteVars().hexColors({hex:0x0000FF}).onUpdate(applyColor)); -function applyColor():void { - mc.graphics.clear(); - mc.graphics.beginFill(myColor.hex, 1); - mc.graphics.drawRect(0, 0, 100, 100); - mc.graphics.endFill(); -} - - * - **/ - public function hexColors(values:Object):TweenLiteVars { - return _set("hexColors", values, true); - } - - - /** - * MotionBlurPlugin provides an easy way to apply a directional blur to a DisplayObject based on its velocity - * and angle of movement in 2D (x/y). This creates a much more realistic effect than a standard BlurFilter for - * several reasons: - *
    - *
  1. A regular BlurFilter is limited to blurring horizontally and/or vertically whereas the motionBlur - * gets applied at the angle at which the object is moving.
  2. - * - *
  3. A BlurFilter tween has static start/end values whereas a motionBlur tween dynamically adjusts the - * values on-the-fly during the tween based on the velocity of the object. So if you use a Strong.easeInOut - * for example, the strength of the blur will start out low, then increase as the object moves faster, and - * reduce again towards the end of the tween.
  4. - *
- * - *

motionBlur even works on bezier/bezierThrough tweens!

- * - *

To accomplish the effect, MotionBlurPlugin creates a Bitmap that it places over the original object, changing - * alpha of the original to [almost] zero during the course of the tween. The original DisplayObject still follows the - * course of the tween, so MouseEvents are properly dispatched. You shouldn't notice any loss of interactivity. - * The DisplayObject can also have animated contents - MotionBlurPlugin automatically updates on every frame. - * Be aware, however, that as with most filter effects, MotionBlurPlugin is somewhat CPU-intensive, so it is not - * recommended that you tween large quantities of objects simultaneously. You can activate fastMode - * to significantly speed up rendering if the object's contents and size/color doesn't need to change during the - * course of the tween.

- * - * @param strength Determines the strength of the blur. The default is 1. For a more powerful blur, increase the number. Or reduce it to make the effect more subtle. - * @param fastMode Setting fastMode to true will significantly improve rendering performance but it is only appropriate for situations when the target object's contents, size, color, filters, etc. do not need to change during the course of the tween. It works by essentially taking a BitmapData snapshot of the target object at the beginning of the tween and then reuses that throughout the tween, blurring it appropriately. The default value for fastMode is false. - * @param quality The lower the quality, the less CPU-intensive the effect will be. Options are 1, 2, or 3. The default is 2. - * @param padding padding controls the amount of space around the edges of the target object that is included in the BitmapData capture (the default is 10 pixels). If the target object has filters applied to it like a GlowFilter or DropShadowFilter that extend beyond the bounds of the object itself, you might need to increase the padding to accommodate the filters. - * @return The TweenLiteVars instance - */ - public function motionBlur(strength:Number=1, fastMode:Boolean=false, quality:int=2, padding:int=10):TweenLiteVars { - return _set("motionBlur", {strength:strength, fastMode:fastMode, quality:quality, padding:padding}, true); - } - - /** - * A common effect that designers/developers want is for a MovieClip/Sprite to orient itself in the direction of - * a Bezier path (alter its rotation). orientToBezier makes it easy. In order to alter a rotation property accurately, - * TweenLite/Max needs 4 pieces of information: - *
    - *
  1. Position property 1 (typically "x")
  2. - *
  3. Position property 2 (typically "y")
  4. - *
  5. Rotational property (typically "rotation")
  6. - *
  7. Number of degrees to add (optional - makes it easy to orient your MovieClip/Sprite properly)
  8. - *
- * - *

The orientToBezier property should be an Array containing one Array for each set of these values. - * For maximum flexibility, you can pass in any number of Arrays inside the container Array, one for - * each rotational property. This can be convenient when working in 3D because you can rotate on multiple axis. - * If you're doing a standard 2D x/y tween on a bezier, you can simply pass in a boolean value of true and - * TweenMax will use a typical setup, [["x", "y", "rotation", 0]]. - * Hint: Don't forget the container Array (notice the double outer brackets)

- * - *

To use the default value ([["x", "y", "rotation", 0]]), you can simply leave the values parameter as null.

- */ - public function orientToBezier(values:Object=null):TweenLiteVars { - return _set("orientToBezier", (values == null) ? true : values, false); - } - - - /** - * Provides simple physics functionality for tweening a DisplayObject's x and y coordinates based on a - * combination of velocity, angle, gravity, acceleration, accelerationAngle, and/or friction. It is not intended - * to replace a full-blown physics engine and does not offer collision detection, but serves - * as a way to easily create interesting physics-based effects with the GreenSock tweening platform. Parameters - * are not intended to be dynamically updateable, but one unique convenience is that everything is reverseable. - * So if you spawn a bunch of particle tweens, for example, and throw them into a TimelineLite, you could - * simply call reverse() on the timeline to watch the particles retrace their steps right back to the beginning. - * Keep in mind that any easing equation you define for your tween will be completely ignored for these properties. - * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.Physics2DPlugin; -TweenPlugin.activate([Physics2DPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 2, new TweenLiteVars().physics2D(300, -60, 400)); - - * - *

Physics2DPlugin is a Club GreenSock membership benefit. You must have a valid membership to use this class - * without violating the terms of use. Visit http://www.greensock.com/club/ to sign up or get more details.

- * - * @param velocity The initial velocity of the object measured in pixels per time unit (usually seconds, but for tweens where useFrames is true, it would be measured in frames). The default is zero. - * @param angle The initial angle (in degrees) at which the object is traveling. Only pertinent when a velocity is defined. For example, if the object should start out traveling at -60 degrees (towards the upper right), the angle would be -60. The default is zero. - * @param acceleration The amount of acceleration applied to the object, measured in pixels per time unit (usually seconds, but for tweens where useFrames is true, it would be measured in frames). To apply the acceleration in a specific direction that is different than the angle, use the accelerationAngle property. - * @param accelerationAngle The angle at which acceleration is applied (if any), measured in degrees. So if, for example, you want the object to accelerate towards the left side of the screen, you'd use an accelerationAngle of 180. - * @param friction A value between 0 and 1 where 0 is no friction, 0.08 is a small amount of friction, and 1 will completely prevent any movement. This is not meant to be precise or scientific in any way, but rather serves as an easy way to apply a friction-like physics effect to your tween. Generally it is best to experiment with this number a bit. Also note that friction requires more processing than physics tweens without any friction. - * @return The TweenLiteVars instance - * @see #physicsProps() - */ - public function physics2D(velocity:Number, angle:Number, acceleration:Number=0, accelerationAngle:Number=90, friction:Number=0):TweenLiteVars { - return _set("physics2D", {velocity:velocity, angle:angle, acceleration:acceleration, accelerationAngle:accelerationAngle, friction:friction}, true); - } - - /** - * Sometimes you want to tween a property (or several) but you don't have a specific end value in mind - instead, - * you'd rather describe the movement in terms of physics concepts, like velocity, acceleration, - * and/or friction. physicsProps allows you to tween any numeric property of any object based - * on these concepts. Keep in mind that any easing equation you define for your tween will be completely - * ignored for these properties. Instead, the physics parameters will determine the movement/easing. - * These parameters, by the way, are not intended to be dynamically updateable, but one unique convenience - * is that everything is reverseable. So if you create several physics-based tweens, for example, and - * throw them into a TimelineLite, you could simply call reverse() on the timeline to watch the objects - * retrace their steps right back to the beginning. Here are the parameters you can define (note that - * friction and acceleration are both completely optional): - *
    - *
  • velocity : Number - the initial velocity of the object measured in units per time - * unit (usually seconds, but for tweens where useFrames is true, it would - * be measured in frames). The default is zero.
  • - *
  • acceleration : Number [optional] - the amount of acceleration applied to the object, measured - * in units per time unit (usually seconds, but for tweens where useFrames - * is true, it would be measured in frames). The default is zero.
  • - *
  • friction : Number [optional] - a value between 0 and 1 where 0 is no friction, 0.08 is a small amount of - * friction, and 1 will completely prevent any movement. This is not meant to be precise or - * scientific in any way, but rather serves as an easy way to apply a friction-like - * physics effect to your tween. Generally it is best to experiment with this number a bit. - * Also note that friction requires more processing than physics tweens without any friction.
  • - *
- * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.PhysicsPropsPlugin; -TweenPlugin.activate([PhysicsPropsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 2, new TweenLiteVars().physicsProps({ - x:{velocity:100, acceleration:200}, - y:{velocity:-200, friction:0.1} - } -)); - - * - *

PhysicsPropsPlugin is a Club GreenSock membership benefit. You must have a valid membership to use this class - * without violating the terms of use. Visit http://www.greensock.com/club/ to sign up or get more details.

- * - * @see #physics2D() - **/ - public function physicsProps(values:Object):TweenLiteVars { - return _set("physicsProps", values, true); - } - - /** An object with properties that correspond to the quaternion properties of the target object. For example, if your my3DObject has "orientation" and "childOrientation" properties that contain quaternions, and you'd like to tween them both, you'd do: {orientation:myTargetQuaternion1, childOrientation:myTargetQuaternion2}. Quaternions must have the following properties: x, y, z, and w. **/ - public function quaternions(values:Object):TweenLiteVars { - return _set("quaternions", values, true); - } - - /** Removes the tint of a DisplayObject over time. **/ - public function removeTint(remove:Boolean=true):TweenLiteVars { - return _set("removeTint", remove, true); - } - - /** - * Tweens the scrollRect property of a DisplayObject. You can define any (or all) of the following properties: - * - *
    - *
  • x : Number
  • - *
  • y : Number
  • - *
  • width : Number
  • - *
  • height : Number
  • - *
  • top : Number
  • - *
  • bottom : Number
  • - *
  • left : Number
  • - *
  • right : Number
  • - *
- *
- * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.ScrollRectPlugin; -TweenPlugin.activate([ScrollRectPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 1, new TweenLiteVars().scrollRect({x:50, y:300, width:100, height:100})); - - **/ - public function scrollRect(props:Object):TweenLiteVars { - return _set("scrollRect", props, true); - } - - /** - * Some components require resizing with setSize() instead of standard tweens of width/height in - * order to scale properly. The SetSizePlugin accommodates this easily. You can define the width, - * height, or both. - * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.SetSizePlugin; -TweenPlugin.activate([SetSizePlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(myComponent, 1, new TweenLiteVars().setSize(200, 30)); - - **/ - public function setSize(width:Number=NaN, height:Number=NaN):TweenLiteVars { - var values:Object = {}; - if (!isNaN(width)) { - values.width = width; - } - if (!isNaN(height)) { - values.height = height; - } - return _set("setSize", values, true); - } - - /** - * To tween any rotation property of the target object in the shortest direction, use "shortRotation" - * For example, if myObject.rotation is currently 170 degrees and you want to tween it to - * -170 degrees, a normal rotation tween would travel a total of 340 degrees in the counter-clockwise - * direction, but if you use shortRotation, it would travel 20 degrees in the clockwise direction instead. - * You can define any number of rotation properties in the shortRotation object which makes 3D tweening - * easier, like: - * - *

- * TweenLite.to(mc, 2, new TweenLiteVars().shortRotation({rotationX:-170, rotationY:35, rotationZ:200})); - *

- * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.ShortRotationPlugin; -TweenPlugin.activate([ShortRotationPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 1, new TweenLiteVars().shortRotation({rotation:-170})); - -//or for a 3D tween with multiple rotation values... -TweenLite.to(mc, 1, new TweenLiteVars().shortRotation({rotationX:-170, rotationY:35, rotationZ:10})); - - **/ - public function shortRotation(values:Object):TweenLiteVars { - if (typeof(values) == "number") { - values = {rotation:values}; - } - return _set("shortRotation", values, true); - } - - - /** - * Tweens properties of an object's soundTransform property (like the volume, pan, leftToRight, etc. - * of a MovieClip/SoundChannel/NetStream). - * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.SoundTransformPlugin; -TweenPlugin.activate([SoundTransformPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 1, new TweenLiteVars().soundTransform(0.2, 0.5)); - - * - * @param volume The volume, ranging from 0 (silent) to 1 (full volume). - * @param pan The left-to-right panning of the sound, ranging from -1 (full pan left) to 1 (full pan right). - * @param leftToLeft A value, from 0 (none) to 1 (all), specifying how much of the left input is played in the left speaker. - * @param leftToRight A value, from 0 (none) to 1 (all), specifying how much of the left input is played in the right speaker. - * @param rightToLeft A value, from 0 (none) to 1 (all), specifying how much of the right input is played in the left speaker. - * @param rightToRight A value, from 0 (none) to 1 (all), specifying how much of the right input is played in the right speaker. - * @return The TweenLiteVars instance - */ - public function soundTransform(volume:Number=1, pan:Number=0, leftToLeft:Number=1, leftToRight:Number=0, rightToLeft:Number=0, rightToRight:Number=1):TweenLiteVars { - return _set("soundTransform", {volume:volume, pan:pan, leftToLeft:leftToLeft, leftToRight:leftToRight, rightToLeft:rightToLeft, rightToRight:rightToRight}, true); - } - - /** - * Sets the stage's quality to a particular value during a tween and another value after - * the tween which can be useful for improving rendering performance in the Flash Player while things are animating. - * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.StageQualityPlugin; -import flash.display.StageQuality; -TweenPlugin.activate([StageQualityPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 1, new TweenLiteVars().prop("x", 100).stageQuality(this.stage, StageQuality.LOW, StageQuality.HIGH)); - - * - * @param stage A reference to the stage - * @param during The stage quality that should be used during the tween - * @param after The stage quality that should be set after the tween completes - * @return The TweenLiteVars instance - */ - public function stageQuality(stage:Stage, during:String="medium", after:String=null):TweenLiteVars { - if (after == null) { - after = stage.quality; - } - return _set("stageQuality", {stage:stage, during:during, after:after}, true); - } - - /** - * Allows you to define an initial velocity at which a property (or multiple properties) will start tweening, - * as well as [optional] maximum and/or minimum end values and then it will calculate the appropriate landing - * position and plot a smooth course to it based on the easing equation you define (Quad.easeOut by default, - * as set in TweenLite). This is perfect for flick-scrolling or animating things as though they are being thrown. - * - *

In its simplest form, you can pass just the initial velocity for each property like this: - * {x:500, y:-300}

- * - *

In the above example, x will animate at 500 pixels per second initially and - * y will animate at -300 pixels per second. Both will decelerate smoothly - * until they come to rest based on the tween's duration.

- * - *

To impose maximum and minimum boundaries on the end values, use the nested object syntax - * with the max and min special properties like this: - * {x:{velocity:500, max:1024, min:0}, y:{velocity:-300, max:720, min:0}}; - *

- * - *

Notice the nesting of the objects ({}). The max and min values refer - * to the range for the final resting position (coordinates in this case), NOT the velocity. - * So x would always land between 0 and 1024 in this case, and y - * would always land between 0 and 720. If you want the target object to land on a specific value - * rather than within a range, simply set max and min to identical values. - * Also notice that you must define a velocity value for each property in the object syntax.

- * - *

throwProps isn't just for tweening x and y coordinates. It works with any numeric - * property, so you could use it for spinning the rotation of an object as well. Or the - * scaleX/scaleY properties. Maybe the user drags to spin a wheel and - * lets go and you want it to continue increasing the rotation at that velocity, - * decelerating smoothly until it stops.

- * - *

ThrowPropsPlugin is a Club GreenSock membership benefit. - * You must have a valid membership to use this class without violating the terms of use. Visit - * http://www.greensock.com/club/ to sign up or get more details.

- **/ - public function throwProps(props:Object):TweenLiteVars { - return _set("throwProps", props, true); - } - - /** - * To change a DisplayObject's tint, set this to the hex value of the color you'd like the DisplayObject - * to end up at (or begin at if you're using TweenLite.from()). An example hex value would be 0xFF0000. - * If you'd like to remove the tint from a DisplayObject, use the removeTint special property. - * @see #removeTint() - * @see #colorMatrixFilter() - * @see #colorTransform() - **/ - public function tint(color:uint):TweenLiteVars { - return _set("tint", color, true); - } - - /** - * Normally, all transformations (scale, rotation, and position) are based on the DisplayObject's registration - * point (most often its upper left corner), but TransformAroundCenter allows you to make the transformations - * occur around the DisplayObject's center. - * - *

If you define an x or y value in the transformAroundCenter object, it will correspond to the center which - * makes it easy to position (as opposed to having to figure out where the original registration point - * should tween to). If you prefer to define the x/y in relation to the original registration point, do so outside - * the transformAroundCenter object, like:

- * - *

- * TweenLite.to(mc, 3, new TweenLiteVars().prop("x", 50).prop("y", 40).transformAroundCenter({scale:0.5, rotation:30})); - *

- * - *

TransformAroundCenterPlugin is a Club GreenSock membership benefit. - * You must have a valid membership to use this class without violating the terms of use. Visit - * http://www.greensock.com/club/ to sign up or get more details.

- * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.TransformAroundCenterPlugin; -TweenPlugin.activate([TransformAroundCenterPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 1, new TweenLiteVars().transformAroundCenter({scale:1.5, rotation:150})); - - * @see #transformAroundPoint() - **/ - public function transformAroundCenter(props:Object):TweenLiteVars { - return _set("transformAroundCenter", props, true); - } - - /** - * Normally, all transformations (scale, rotation, and position) are based on the DisplayObject's registration - * point (most often its upper left corner), but TransformAroundPoint allows you to define ANY point around which - * transformations will occur during the tween. For example, you may have a dynamically-loaded image that you - * want to scale from its center or rotate around a particular point on the stage. - * - *

If you define an x or y value in the transformAroundPoint object, it will correspond to the custom registration - * point which makes it easy to position (as opposed to having to figure out where the original registration point - * should tween to). If you prefer to define the x/y in relation to the original registration point, do so outside - * the transformAroundPoint object, like:

- * - *

- * TweenLite.to(mc, 3, new TweenLiteVars().prop("x", 50).prop("y", 40).transformAroundPoint(new Point(200, 300), {scale:0.5, rotation:30})); - *

- * - *

TransformAroundPointPlugin is a Club GreenSock membership benefit. - * You must have a valid membership to use this class without violating the terms of use. Visit - * http://www.greensock.com/club/ to sign up or get more details.

- * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.TransformAroundPointPlugin; -TweenPlugin.activate([TransformAroundPointPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 1, new TweenLiteVars().transformAroundPoint(new Point(100, 300), {scaleX:2, scaleY:1.5, rotation:150})); - - * @see #transformAroundCenter() - **/ - public function transformAroundPoint(point:Point, props:Object):TweenLiteVars { - props.point = point; - return _set("transformAroundPoint", props, true); - } - - /** - * transformMatrix tweens a DisplayObject's transform.matrix values directly either using - * the standard matrix properties (a, b, c, d, tx, and ty) or common properties - * like x, y, scaleX, scaleY, skewX, skewY, rotation and even shortRotation. - * To skew without adjusting scale visually, use skewX2 and skewY2 instead of skewX and skewY. - * - * - *

transformMatrix tween will affect all of the DisplayObject's transform properties, so do not use - * it in conjunction with regular x/y/scaleX/scaleY/rotation tweens concurrently.

- * - *

USAGE:

- * -import com.greensock.TweenLite; -import com.greensock.data.TweenLiteVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.TransformMatrixPlugin; -TweenPlugin.activate([TransformMatrixPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenLite.to(mc, 1, new TweenLiteVars().transformMatrix({x:50, y:300, scaleX:2, scaleY:2})); - -//-OR- - -TweenLite.to(mc, 1, new TweenLiteVars().transformMatrix({tx:50, ty:300, a:2, d:2})); - - **/ - public function transformMatrix(properties:Object):TweenLiteVars { - return _set("transformMatrix", properties, true); - } - - /** Sets a DisplayObject's "visible" property at the end of the tween. **/ - public function visible(value:Boolean):TweenLiteVars { - return _set("visible", value, true); - } - - /** Changes the volume of any object that has a soundTransform property (MovieClip, SoundChannel, NetStream, etc.) **/ - public function volume(volume:Number):TweenLiteVars { - return _set("volume", volume, true); - } - - -//---- GETTERS / SETTERS ------------------------------------------------------------------------------------------------------------- - - /** The generic object populated by all of the method calls in the TweenLiteVars instance. This is the raw data that gets passed to the tween. **/ - public function get vars():Object { - return _vars; - } - - /** @private **/ - public function get _isGSVars():Boolean { - return true; - } - - } -} \ No newline at end of file diff --git a/src/com/greensock/data/TweenMaxVars.as b/src/com/greensock/data/TweenMaxVars.as deleted file mode 100644 index 45fac009..00000000 --- a/src/com/greensock/data/TweenMaxVars.as +++ /dev/null @@ -1,1285 +0,0 @@ -/** - * VERSION: 12.01 - * DATE: 2012-09-11 - * AS3 - * UPDATES AND DOCS AT: http://www.greensock.com/tweenvars/ - **/ -package com.greensock.data { - import com.greensock.TweenLite; - import com.greensock.TweenMax; - import com.greensock.motionPaths.MotionPath; - - import flash.display.Stage; - import flash.geom.Point; -/** - * [AS3 only] There are 3 primary benefits of using a TweenMaxVars instance to define your TweenMax's "vars" parameter: - *
    - *
  1. In most code editors, code hinting will be activated which helps remind you which special properties are available.
  2. - *
  3. It allows you to code using strict data typing which can improve debugging.
  4. - *
  5. It will trace() a warning if you forgot to activate a particular plugin. For example, if you define an autoAlpha value in a TweenMaxVars instance but you didn't activate() the plugin, you'll see a trace() output when you test/compile the file (an Error isn't thrown because in some very rare circumstances it can be perfectly legitimate to avoid activating the plugin)
  6. - *
- * - *

The down side, of course, is that the code is more verbose and TweenMaxVars adds about 6kb to your published swf.

- * - *

USAGE:

- *

Note that each method returns the TweenMaxVars object, so you can reduce the lines of code by method chaining (see example below).

- * - *

Without TweenMaxVars:

- *

TweenMax.to(mc, 1, {x:300, y:100, tint:0xFF0000, onComplete:myFunction, onCompleteParams:[mc]})

- * - *

With TweenMaxVars

- *

TweenMax.to(mc, 1, new TweenMaxVars().move(300, 100).tint(0xFF0000).onComplete(myFunction, [mc]));

- * - *

You can use the prop() method to set individual generic properties (like "myCustomProperty" or "rotationY") or you can - * pass a generic Object into the constructor to make it a bit more concise, like this:

- * - *

TweenMax.to(mc, 1, new TweenMaxVars({myCustomProperty:300, rotationY:100}).tint(0xFF0000).onComplete(myFunction, [mc]));

- * - *

NOTES:

- *
    - *
  • To get the generic vars object that TweenMaxVars builds internally, simply access its "vars" property. - * In fact, if you want maximum backwards compatibility, you can tack ".vars" onto the end of your chain like this: - * TweenMax.to(mc, 1, new TweenMaxVars({x:300, y:100}).tint(0xFF0000).onComplete(myFunction, [mc]).vars);
  • - *
  • This class adds about 6kb to your published SWF (not including TweenMax or any plugins).
  • - *
  • Using TweenMaxVars is completely optional. If you prefer the shorter generic object synatax, feel - * free to use it. The purpose of this utility is simply to enable code hinting and to allow for strict datatyping.
  • - *
- * - *

Copyright 2008-2014, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for Club GreenSock members, the software agreement that was issued with the membership.

- * - * @author Jack Doyle, jack@greensock.com - */ - public class TweenMaxVars { - /** @private **/ - public static const version:String = "12.0.0"; - - /** @private **/ - protected var _vars:Object; - - /** - * Constructor - * @param vars A generic Object containing properties that you'd like added (copied) to this TweenMaxVars instance. This is particularly useful for generic properties that don't have a corresponding method for setting the values (although you can use it for properties that do have corresponding methods too). For example, to tween the x and y properties of a DisplayObject, new TweenMaxVars({x:300, y:0}) - */ - public function TweenMaxVars(vars:Object=null) { - _vars = {}; - if (vars != null) { - for (var p:String in vars) { - _vars[p] = vars[p]; - } - } - } - - /** @private **/ - protected function _set(property:String, value:*, requirePlugin:Boolean=false):TweenMaxVars { - if (value == null) { - delete _vars[property]; //in case it was previously set - } else { - _vars[property] = value; - } - if (requirePlugin && !(property in TweenLite._plugins)) { - trace("WARNING: you must activate() the " + property + " plugin in order for the feature to work in TweenMax. See http://www.greensock.com/tweenlite/#plugins for details."); - } - return this; - } - - /** - * Adds a dynamic property for tweening and allows you to indicate whether the value is relative or not. - * For example, to tween "x" to 50 less than whatever it currently is: - * - *

prop("x", -50, true);

- * - * @param property Property name - * @param value Numeric end value (or beginning value for from() tweens) - * @param relative If true, the value will be interpreted as relative to the target's current value. For example, if mc.x is currently 300 and you do prop("x", 200, true), the end value will be 500. - */ - public function prop(property:String, value:Number, relative:Boolean=false):TweenMaxVars { - return _set(property, (!relative) ? value : (value < 0) ? "-=" + (-value) : "+=" + value); - } - - -//---- BUILT-IN SPECIAL PROPERTIES (NO PLUGIN ACTIVATION REQUIRED) -------------------------------------------------------------- - - /** Any generic data that you'd like associated with your tween. **/ - public function data(data:*):TweenMaxVars { - return _set("data", data); - } - - /** The number of seconds (or frames for frames-based tweens) to delay before the tween begins. **/ - public function delay(delay:Number):TweenMaxVars { - return _set("delay", delay); - } - - /** - * Controls the rate of change. Use any standard easing equation like ElasticOut.ease. The Default is QuadOut.ease. - * - * @param ease An ease (i.e. com.greensock.easing.ElasticOut.ease) The default is QuadOut.ease. - * @param easeParams An Array of extra parameter values to feed the easing equation (beyond the standard 4). This can be useful with easing equations like Elastic that accept extra parameters like the amplitude and period. Most easing equations, however, don't accept extra parameters so you won't need to pass in any easeParams. - **/ - public function ease(ease:*, easeParams:Array=null):TweenMaxVars { - _set("easeParams", easeParams); - return _set("ease", ease); - } - - /** - * Normally when you create a tween, it begins rendering on the very next frame (when - * the Flash Player dispatches an ENTER_FRAME event) unless you specify a delay. - * This allows you to insert tweens into timelines and perform other actions that may affect - * its timing. However, if you prefer to force the tween to render immediately when it is - * created, set immediateRender to true. from() tweens - * render immediately by default, so to prevent that behavior, set immediateRender - * to false. - **/ - public function immediateRender(value:Boolean):TweenMaxVars { - return _set("immediateRender", value, false); - } - - /** - * A function that should be called when the tween has completed. - * - * @param func A function that should be called when the tween has completed. - * @param params An Array of parameters to pass the onComplete function - **/ - public function onComplete(func:Function, params:Array=null):TweenMaxVars { - _set("onCompleteParams", params); - return _set("onComplete", func); - } - - /** - * A function that should be called after the tween has completed and rendered its final state to the stage (waits for the next ENTER_FRAME event is dispatched after the tween finishes). Target must be a DisplayObject. - * - * @param func A function that should be called after the tween has completed and rendered its final state to the stage (waits for the next ENTER_FRAME event is dispatched after the tween finishes). - * @param params An Array of parameters to pass the onCompleteRender function - **/ - public function onCompleteRender(func:Function, params:Array=null):TweenMaxVars { - _set("onCompleteRenderParams", params); - return _set("onCompleteRender", func, true); - } - - /** A function to which the TweenMax instance should dispatch a TweenEvent when it completes. This is the same as doing myTween.addEventListener(TweenEvent.COMPLETE, myFunction); **/ - public function onCompleteListener(func:Function):TweenMaxVars { - return _set("onCompleteListener", func); - } - - /** - * A function that should be called when the tween begins (when its time() is at 0 - * and changes to some other value which can happen more than once if the tween is restarted multiple times). - * - * @param func A function that should be called when the tween begins. - * @param params An Array of parameters to pass the onStart function. - **/ - public function onStart(func:Function, params:Array=null):TweenMaxVars { - _set("onStartParams", params); - return _set("onStart", func); - } - - /** A function to which the TweenMax instance should dispatch a TweenEvent when it begins. This is the same as doing myTween.addEventListener(TweenEvent.START, myFunction); **/ - public function onStartListener(func:Function):TweenMaxVars { - return _set("onStartListener", func) - } - - /** - * A function to call whenever the tweening values are updated (on every frame during the time the tween is active). - * - * @param func A function to call whenever the tweening values are updated. - * @param params An Array of parameters to pass the onUpdate function - **/ - public function onUpdate(func:Function, params:Array=null):TweenMaxVars { - _set("onUpdateParams", params); - return _set("onUpdate", func); - } - - /** A function to which the TweenMax instance should dispatch a TweenEvent every time it updates values. This is the same as doing myTween.addEventListener(TweenEvent.UPDATE, myFunction); **/ - public function onUpdateListener(func:Function):TweenMaxVars { - return _set("onUpdateListener", func); - } - - /** - * A function that should be called every time the tween repeats - * - * @param func A function that should be called every time the tween repeats - * @param params An Array of parameters to pass the onRepeat function - **/ - public function onRepeat(func:Function, params:Array=null):TweenMaxVars { - _set("onRepeatParams", params); - return _set("onRepeat", func); - } - - /** - * A function that should be called when the tween has reached its starting point again after having been reversed. - * - * @param func A function that should be called when the tween has reached its starting point again after having been reversed. - * @param params An Array of parameters to pass the onReverseComplete function - **/ - public function onReverseComplete(func:Function, params:Array=null):TweenMaxVars { - _set("onReverseCompleteParams", params); - return _set("onReverseComplete", func); - } - - /** A function to which the TweenMax instance should dispatch a TweenEvent when it has reached its starting point again after having been reversed **/ - public function onReverseCompleteListener(func:Function):TweenMaxVars { - return _set("onReverseCompleteListener", func); - } - - /** - * Controls how (and if) other tweens of the same target are overwritten. - * There are several modes to choose from, but "auto" is the default (although - * you can change the default mode using the TweenLite.defaultOverwrite property): - *
    - *
  • "none" - no overwriting will occur.
  • - * - *
  • "all" - immediately overwrites all existing - * tweens of the same target even if they haven't started yet or don't have - * conflicting properties.
  • - * - *
  • "auto" - when the tween renders for the first time, it will analyze - * tweens of the same target that are currently active/running and only overwrite - * individual tweening properties that overlap/conflict. Tweens that haven't begun - * yet are ignored. For example, if another active tween is found that is tweening - * 3 properties, only 1 of which it shares in common with the new tween, the other - * 2 properties will be left alone. Only the conflicting property gets overwritten/killed. - * This is the default mode and typically the most intuitive for developers.
  • - * - *
  • "concurrent" - when the tween renders for the first time, it kills - * only the active (in-progress) tweens of the same target regardless of whether - * or not they contain conflicting properties. Like a mix of "all" - * and "auto". Good for situations where you only want one tween - * controling the target at a time.
  • - * - *
  • "allOnStart" - Identical to "all" but waits to run - * the overwrite logic until the tween begins (after any delay). Kills - * tweens of the same target even if they don't contain conflicting properties - * or haven't started yet.
  • - * - *
  • "preexisting" - when the tween renders for the first time, it kills - * only the tweens of the same target that existed BEFORE this tween was created - * regardless of their scheduled start times. So, for example, if you create a tween - * with a delay of 10 and then a tween with a delay of 1 and then a tween with a - * delay of 2 (all of the same target), the 2nd tween would overwrite the first - * but not the second even though scheduling might seem to dictate otherwise. - * "preexisting" only cares about the order in which the instances - * were actually created. This can be useful when the order in which your code runs - * plays a critical role.
  • - *
- **/ - public function overwrite(value:String):TweenMaxVars { - return _set("overwrite", value, false); - } - - /** Controls the paused state of the tween - if true, the tween will be paused initially. **/ - public function paused(value:Boolean):TweenMaxVars { - return _set("paused", value, false); - } - - /** Number of times that the tween should repeat (to repeat indefinitely, use -1). **/ - public function repeat(value:int):TweenMaxVars { - return _set("repeat", value); - } - - /** Amount of time in seconds (or frames for frames-based tween) between repeats. **/ - public function repeatDelay(value:Number):TweenMaxVars { - return _set("repeatDelay", value); - } - - /** - * If true, the tween will be reversed initially. This does not swap the starting/ending - * values in the tween - it literally changes its orientation/direction. Imagine the playhead - * moving backwards instead of forwards. This does NOT force it to the very end and start - * playing backwards. It simply affects the orientation of the tween, so if reversed is set to - * true initially, it will appear not to play because it is already at the beginning. To cause it to - * play backwards from the end, set reversed to true and then set the currentProgress - * property to 1 immediately after creating the tween (or set the currentTime to the duration). - **/ - public function reversed(value:Boolean):TweenMaxVars { - return _set("reversed", value); - } - - /** When true, the tween will flip the start and end values which is exactly what TweenMax.from() does. **/ - public function runBackwards(value:Boolean):TweenMaxVars { - return _set("runBackwards", value, false); - } - - /** Multiplier affecting the speed of the timeline where 1 is normal speed, 0.5 is half-speed, 2 is double speed, etc. **/ - public function timeScale(value:Number):TweenMaxVars { - return _set("timeScale", value, false); - } - - /** - * If useFrames is set to true, the tweens's timing mode will be based on frames. - * Otherwise, it will be based on seconds/time. NOTE: a tween's timing mode is always - * determined by its parent timeline. - **/ - public function useFrames(value:Boolean):TweenMaxVars { - return _set("useFrames", value, false); - } - - /** Allows you to define the starting values for properties. It is the same as defining the "from" parameter in a TweenMax.fromTo() call. **/ - public function startAt(vars:TweenMaxVars):TweenMaxVars { - return _set("startAt", vars.vars); - } - - /** - * Works in conjunction with the repeat property, determining the behavior of each - * cycle. When yoyo is true, the tween will go back and forth, appearing to reverse - * every other cycle (this has no affect on the "reversed" property though). So if repeat is - * 2 and yoyo is false, it will look like: start - 1 - 2 - 3 - 1 - 2 - 3 - 1 - 2 - 3 - end. But - * if repeat is 2 and yoyo is true, it will look like: start - 1 - 2 - 3 - 3 - 2 - 1 - 1 - 2 - 3 - end. - **/ - public function yoyo(value:Boolean):TweenMaxVars { - return _set("yoyo", value); - } - - //---- COMMON CONVENIENCE PROPERTIES (NO PLUGIN REQUIRED) ------------------------------------------------------------------- - - /** Tweens the "x" and "y" properties of the target **/ - public function move(x:Number, y:Number, relative:Boolean=false):TweenMaxVars { - prop("x", x, relative); - return prop("y", y, relative); - } - - /** Tweens the "scaleX" and "scaleY" properties of the target **/ - public function scale(value:Number, relative:Boolean=false):TweenMaxVars { - prop("scaleX", value, relative); - return prop("scaleY", value, relative); - } - - /** Tweens the "rotation" property of the target **/ - public function rotation(value:Number, relative:Boolean=false):TweenMaxVars { - return prop("rotation", value, relative); - } - - /** Tweens the "scaleX" property of the target **/ - public function scaleX(value:Number, relative:Boolean=false):TweenMaxVars { - return prop("scaleX", value, relative); - } - - /** Tweens the "scaleY" property of the target **/ - public function scaleY(value:Number, relative:Boolean=false):TweenMaxVars { - return prop("scaleY", value, relative); - } - - /** Tweens the "width" property of the target **/ - public function width(value:Number, relative:Boolean=false):TweenMaxVars { - return prop("width", value, relative); - } - - /** Tweens the "height" property of the target **/ - public function height(value:Number, relative:Boolean=false):TweenMaxVars { - return prop("height", value, relative); - } - - /** Tweens the "x" property of the target **/ - public function x(value:Number, relative:Boolean=false):TweenMaxVars { - return prop("x", value, relative); - } - - /** Tweens the "y" property of the target **/ - public function y(value:Number, relative:Boolean=false):TweenMaxVars { - return prop("y", value, relative); - } - - - -//---- PLUGIN REQUIRED ------------------------------------------------------------------------------------------- - - /** Same as changing the "alpha" property but with the additional feature of toggling the "visible" property to false whenever alpha is 0, thus improving rendering performance in the Flash Player. **/ - public function autoAlpha(alpha:Number):TweenMaxVars { - return _set("autoAlpha", alpha, true); - } - - /** - * Tweens a BevelFilter - * - * @param distance The offset distance of the bevel. - * @param angle The angle of the bevel. - * @param highlightColor The highlight color of the bevel. - * @param highlightAlpha The alpha transparency value of the highlight color. - * @param shadowColor The shadow color of the bevel. - * @param shadowAlpha The alpha transparency value of the shadow color. - * @param blurX The amount of horizontal blur, in pixels. - * @param blurY The amount of vertical blur, in pixels. - * @param strength The strength of the imprint or spread. - * @param quality The number of times to apply the filter. - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new BevelFilter will be added to the target even if a BevelFilter is already in its filters array. - * @param index Allows you to target a particular BevelFilter if there are multiple BevelFilters in the target's filters array - simply define the index value corresponding to the BevelFilter's position in the filters array. - * @return The TweenMaxVars instance - */ - public function bevelFilter(distance:Number=4, angle:Number=45, highlightColor:uint=0xFFFFFF, highlightAlpha:Number=0.5, shadowColor:uint=0x000000, shadowAlpha:Number=0.5, blurX:Number=4, blurY:Number=4, strength:Number=1, quality:int=2, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenMaxVars { - var filter:Object = {distance:distance, angle:angle, highlightColor:highlightColor, highlightAlpha:highlightAlpha, shadowColor:shadowColor, shadowAlpha:shadowAlpha, blurX:blurX, blurY:blurY, strength:strength, quality:quality, addFilter:addFilter, remove:remove}; - if (index > -1) { - filter.index = index; - } - return _set("bevelFilter", filter, true); - } - - /** - * Bezier tweening allows you to tween in a non-linear way. For example, you may want to tween - * a MovieClip's position from the origin (0,0) 500 pixels to the right (500,0) but curve downwards - * through the middle of the tween. Simply pass as many objects in the bezier Array as you'd like, - * one for each "control point" (see documentation on Flash's curveTo() drawing method for more - * about how control points work). - * - *

Keep in mind that you can bezier tween ANY properties, not just x/y.

- * - *

USAGE:

- * -import com.greensock.TweenMax; -import com.greensock.data.TweenMaxVars; -import com.greensock.plugins.TweenPlugin; -import com.greensock.plugins.BezierPlugin; -TweenPlugin.activate([BezierPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -TweenMax.to(mc, 3, new TweenMaxVars().bezier([{x:250, y:50}, {x:500, y:0}])); //makes my_mc travel through 250,50 and end up at 500,0. - - * - * @param values An array of objects with key/value pairs that define the bezier points like [{x:250, y:50}, {x:500, y:0}] - * @see #bezierThrough() - **/ - public function bezier(values:Array):TweenMaxVars { - return _set("bezier", values, true); - } - - /** - * Identical to bezier except that instead of passing Bezier control point values, you pass values through - * which the Bezier values should move. This can be more intuitive than using control points. - * - * @param values An array of objects with key/value pairs that define the bezier points like [{x:250, y:50}, {x:500, y:0}] - * @see #bezier() - **/ - public function bezierThrough(values:Array):TweenMaxVars { - return _set("bezierThrough", values, true); - } - - /** - * Tweens a BlurFilter - * - * @param blurX The amount of horizontal blur. - * @param blurY The amount of vertical blur. - * @param quality The number of times to perform the blur. - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new BlurFilter will be added to the target even if a BlurFilter is already in its filters array. - * @param index Allows you to target a particular BlurFilter if there are multiple BlurFilters in the target's filters array - simply define the index value corresponding to the BlurFilter's position in the filters array. - * @return The TweenMaxVars instance - */ - public function blurFilter(blurX:Number, blurY:Number, quality:int=2, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenMaxVars { - var filter:Object = {blurX:blurX, blurY:blurY, quality:quality, addFilter:addFilter, remove:remove}; - if (index > -1) { - filter.index = index; - } - return _set("blurFilter", filter, true); - } - - /** - * Tweens an object along a CirclePath2D motion path in any direction (clockwise, counter-clockwise, or shortest). - * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.~~; - import com.greensock.motionPaths.~~ - TweenPlugin.activate([CirclePath2DPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - var circle:CirclePath2D = new CirclePath2D(150, 150, 100); - TweenMax.to(mc, 2, new TweenMaxVars().circlePath2D(circle, 90, 270, false, Direction.CLOCKWISE, 2)); - - * - * @param path The CirclePath2D instance to follow (com.greensock.motionPaths.CirclePath2D) - * @param startAngle The position at which the target should begin its rotation (described in degrees unless useRadians is true in which case it is described in radians). For example, to begin at the top of the circle, use 270 or -90 as the startAngle. - * @param endAngle The position at which the target should end its rotation (described in degrees unless useRadians is true in which case it is described in radians). For example, to end at the bottom of the circle, use 90 as the endAngle. - * @param autoRotate When autoRotate is true, the target will automatically be rotated so that it is oriented to the angle of the path. To offset this value (like to always add 90 degrees for example), use the rotationOffset property. - * @param direction The direction in which the target should travel around the path. Options are Direction.CLOCKWISE ("clockwise"), Direction.COUNTER_CLOCKWISE ("counterClockwise"), or Direction.SHORTEST ("shortest"). - * @param extraRevolutions If instead of going directly to the endAngle, you want the target to travel one or more extra revolutions around the path before going to the endAngle, define that number of revolutions here. - * @param rotationOffset When autoRotate is true, this value will always be added to the resulting rotation of the target. - * @param useRadians If you prefer to define values in radians instead of degrees, set useRadians to true. - * @return The TweenMaxVars instance - */ - public function circlePath2D(path:MotionPath, startAngle:Number, endAngle:Number, autoRotate:Boolean=false, direction:String="clockwise", extraRevolutions:uint=0, rotationOffset:Number=0, useRadians:Boolean=false):TweenMaxVars { - return _set("circlePath2D", {path:path, startAngle:startAngle, endAngle:endAngle, autoRotate:autoRotate, direction:direction, extraRevolutions:extraRevolutions, rotationOffset:rotationOffset, useRadians:useRadians}, true); - } - - /** - * ColorMatrixFilter tweening offers an easy way to tween a DisplayObject's saturation, hue, contrast, - * brightness, and colorization. - * - *

HINT: If you'd like to match the ColorMatrixFilter values you created in the Flash IDE on a particular object, - * you can get its matrix like this:

- * - * - import flash.display.DisplayObject; - import flash.filters.ColorMatrixFilter; - - function getColorMatrix(mc:DisplayObject):Array { - var f:Array = mc.filters, i:uint; - for (i = 0; i < f.length; i++) { - if (f[i] is ColorMatrixFilter) { - return f[i].matrix; - } - } - return null; - } - - var myOriginalMatrix:Array = getColorMatrix(my_mc); //store it so you can tween back to it anytime - - * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.ColorMatrixFilterPlugin; - TweenPlugin.activate([ColorMatrixFilterPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 1, new TweenMaxVars().colorMatrixFilter(0xFF0000)); - - * - * @param colorize The color to use for the colorizing effect - colorizing a DisplayObject makes it look as though you're seeing it through a colored piece of glass whereas tinting it makes every pixel exactly that color. You can control the amount of colorization using the "amount" parameter where 1 is full strength, 0.5 is half-strength, and 0 has no colorization effect. - * @param amount A number between 0 and 1 that determines the potency of the colorize effect. This parameter is ignored if the colorize parameter is left at its default value of 0xFFFFFF. - * @param saturation A number indicating the saturation where 1 is normal saturation, 0 makes the target look grayscale, and 2 would be double the normal saturation. - * @param contrast A number indicating the contrast where 1 is normal contrast, 0 is no contrast, and 2 is double the normal contrast, etc. - * @param brightness A number indicating the brightness where 1 is normal brightness, 0 is much darker than normal, and 2 is twice the normal brightness, etc. - * @param hue An angle-like number between 0 and 360 indicating the change in hue. Think of it as degrees, so 180 would be rotating the hue to be exactly opposite as normal, 360 would be the same as 0, etc. - * @param threshold A number from 0 to 255 that controls the threshold of where the pixels turn white or black (leave as -1 to avoid any threshold effect whatsoever). - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new ColorMatrixFilter will be added to the target even if a ColorMatrixFilter is already in its filters array. - * @param index Allows you to target a particular ColorMatrixFilter if there are multiple ColorMatrixFilters in the target's filters array - simply define the index value corresponding to the ColorMatrixFilter's position in the filters array. - * @return The TweenMaxVars instance - */ - public function colorMatrixFilter(colorize:uint=0xFFFFFF, amount:Number=1, saturation:Number=1, contrast:Number=1, brightness:Number=1, hue:Number=0, threshold:Number=-1, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenMaxVars { - var filter:Object = {saturation:saturation, contrast:contrast, brightness:brightness, hue:hue, addFilter:addFilter, remove:remove}; - if (colorize != 0xFFFFFF) { - filter.colorize = colorize; - filter.amount = amount; - } - if (threshold > -1) { - filter.threshold = threshold; - } - if (index > -1) { - filter.index = index; - } - return _set("colorMatrixFilter", filter, true); - } - - /** - * Tweens ColorTransform properties of a DisplayObject to do advanced effects like overexposing, altering - * the brightness or setting the percent/amount of tint. - * - * @param tint The color value for a ColorTransform object. - * @param tintAmount A numeric value between 0 and 1 indicating the potency of the tint. For example, if tint is 0xFF0000 and tintAmount is 0.5, the target would be tinted halfway to red. - * @param exposure A numeric value between 0 and 2 where 1 is normal exposure, 0, is completely underexposed, and 2 is completely overexposed. Overexposing an object is different then changing the brightness - it seems to almost bleach the image and looks more dynamic and interesting (subjectively speaking). - * @param brightness A numeric value between 0 and 2 where 1 is normal brightness, 0 is completely dark/black, and 2 is completely bright/white - * @param redMultiplier A decimal value that is multiplied with the red channel value. - * @param greenMultiplier A decimal value that is multiplied with the green channel value. - * @param blueMultiplier A decimal value that is multiplied with the blue channel value. - * @param alphaMultiplier A decimal value that is multiplied with the alpha transparency channel value. - * @param redOffset A number from -255 to 255 that is added to the red channel value after it has been multiplied by the redMultiplier value. - * @param greenOffset A number from -255 to 255 that is added to the green channel value after it has been multiplied by the greenMultiplier value. - * @param blueOffset A number from -255 to 255 that is added to the blue channel value after it has been multiplied by the blueMultiplier value. - * @param alphaOffset A number from -255 to 255 that is added to the alpha transparency channel value after it has been multiplied by the alphaMultiplier value. - * @return The TweenMaxVars instance - */ - public function colorTransform(tint:Number=NaN, tintAmount:Number=NaN, exposure:Number=NaN, brightness:Number=NaN, redMultiplier:Number=NaN, greenMultiplier:Number=NaN, blueMultiplier:Number=NaN, alphaMultiplier:Number=NaN, redOffset:Number=NaN, greenOffset:Number=NaN, blueOffset:Number=NaN, alphaOffset:Number=NaN):TweenMaxVars { - var values:Object = {tint:tint, tintAmount:isNaN(tint) ? NaN : tintAmount, exposure:exposure, brightness:brightness, redMultiplier:redMultiplier, greenMultiplier:greenMultiplier, blueMultiplier:blueMultiplier, alphaMultiplier:alphaMultiplier, redOffset:redOffset, greenOffset:greenOffset, blueOffset:blueOffset, alphaOffset:alphaOffset}; - for (var p:String in values) { - if (isNaN(values[p])) { - delete values[p]; - } - } - return _set("colorTransform", values, true); - } - - /** - * Tweens a DropShadowFilter. - * - * @param distance The offset distance for the shadow, in pixels. - * @param blurX The amount of horizontal blur. - * @param blurY The amount of vertical blur. - * @param alpha The alpha transparency value for the shadow color. - * @param angle The angle of the shadow. - * @param color The color of the shadow. - * @param strength The strength of the imprint or spread. - * @param inner Indicates whether or not the shadow is an inner shadow. - * @param knockout Applies a knockout effect (true), which effectively makes the object's fill transparent and reveals the background color of the document. - * @param hideObject Indicates whether or not the object is hidden. - * @param quality The number of times to apply the filter. - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new DropShadowFilter will be added to the target even if a DropShadowFilter is already in its filters array. - * @param index Allows you to target a particular DropShadowFilter if there are multiple DropShadowFilters in the target's filters array - simply define the index value corresponding to the DropShadowFilter's position in the filters array. - * @return The TweenMaxVars instance - */ - public function dropShadowFilter(distance:Number=4, blurX:Number=4, blurY:Number=4, alpha:Number=1, angle:Number=45, color:uint=0x000000, strength:Number=2, inner:Boolean=false, knockout:Boolean=false, hideObject:Boolean=false, quality:uint=2, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenMaxVars { - var filter:Object = {distance:distance, blurX:blurX, blurY:blurY, alpha:alpha, angle:angle, color:color, strength:strength, inner:inner, knockout:knockout, hideObject:hideObject, quality:quality, addFilter:addFilter, remove:remove}; - if (index > -1) { - filter.index = index; - } - return _set("dropShadowFilter", filter, true); - } - - /** - * If you'd like to tween something to a destination value that may change at any time, - * dynamicProps allows you to simply associate a function with a property so that - * every time the tween is rendered, it calls that function to get the new destination value - * for the associated property. For example, if you want a MovieClip to tween to wherever the - * mouse happens to be, you could do: - * - * - TweenMax.to(mc, 3, new TweenMaxVars().dynamicProps({x:getMouseX, y:getMouseY})); - function getMouseX():Number { - return this.mouseX; - } - function getMouseY():Number { - return this.mouseY; - } - - * - *

Of course you can get as complex as you want inside your custom function, as long as - * it returns the destination value, TweenLite/Max will take care of adjusting things - * on the fly.

- * - *

You can optionally pass any number of parameters to functions using the "params" - * parameter like so:

- * - * - TweenMax.to(mc, 3, new TweenMaxVars().dynamicProps({x:myFunction, y:myFunction}, {x:[mc2, "x"], y:[mc2, "y"]})); - function myFunction(object:MovieClip, propName:String):Number { - return object[propName]; - } - - * - *

DynamicPropsPlugin is a Club GreenSock membership benefit. - * You must have a valid membership to use this class without violating the terms of use. - * Visit http://www.greensock.com/club/ to sign up or get - * more details.

- * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.~~; - TweenPlugin.activate([DynamicPropsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(my_mc, 3, new TweenMaxVars().dynamicProps({x:getMouseX, y:getMouseY})); - - function getMouseX():Number { - return this.mouseX; - } - function getMouseY():Number { - return this.mouseY; - } - - * @param props An object containing properties that are named cooresponding to the properties of the target that should be affected, and the value should point to the function that handles returning the appropriate value, like {x:getMouseX, y:getMouseY}. - * @param params An object containing properties that are named corresponding to the properties of the target that should be affected, and the value should be an array of parameters that are passed to the corresponding function, like {x:[mc, "param2"], y:[mc, "param2"]} - * @return self - **/ - public function dynamicProps(props:Object, params:Object=null):TweenMaxVars { - if (params != null) { - props.params = params; - } - return _set("dynamicProps", props, true); - } - - /** An Array containing numeric end values of the target Array. Keep in mind that the target of the tween must be an Array with at least the same length as the endArray. **/ - public function endArray(values:Array):TweenMaxVars { - return _set("endArray", values, true); - } - - /** - * Tweens a MovieClip to a particular frame. - * - *

USAGE:

- * - * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.FramePlugin; - TweenPlugin.activate([FramePlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 1, new TweenMaxVars().frame(125)); - - * - *

Note: When tweening the frames of a MovieClip, any audio that is embedded on the MovieClip's timeline - * (as "stream") will not be played. Doing so would be impossible because the tween might speed up or slow - * down the MovieClip to any degree.

- * - * @param value The frame to which the MovieClip should be tweened (or if relative is true, this value would represent the number of frames to travel from the current frame) - * @param relative If true, the frame value will be interpreted as relative to the current frame. So for example, if the MovieClip is at frame 5 currently and frame(10, true) is used, the MovieClip will tween 10 frames and end up on frame 15. - **/ - public function frame(value:int, relative:Boolean=false):TweenMaxVars { - return _set("frame", (relative) ? String(value) : value, true); - } - - /** - * Tweens a MovieClip backward to a particular frame number, wrapping it if/when it reaches the beginning - * of the timeline. For example, if your MovieClip has 20 frames total and it is currently at frame 10 - * and you want tween to frame 15, a normal frame tween would go forward from 10 to 15, but a frameBackward - * would go from 10 to 1 (the beginning) and wrap to the end and continue tweening from 20 to 15. - **/ - public function frameBackward(frame:int):TweenMaxVars { - return _set("frameBackward", frame, true); - } - - /** - * Tweens a MovieClip forward to a particular frame number, wrapping it if/when it reaches the end - * of the timeline. For example, if your MovieClip has 20 frames total and it is currently at frame 10 - * and you want tween to frame 5, a normal frame tween would go backwards from 10 to 5, but a frameForward - * would go from 10 to 20 (the end) and wrap to the beginning and continue tweening from 1 to 5. - **/ - public function frameForward(frame:int):TweenMaxVars { - return _set("frameForward", frame, true); - } - - /** Tweens a MovieClip to a particular frame. **/ - public function frameLabel(label:String):TweenMaxVars { - return _set("frameLabel", label, true); - } - - - /** - * Tweens a GlowFilter - * - * @param blurX The amount of horizontal blur. - * @param blurY The amount of vertical blur. - * @param color The color of the glow. - * @param alpha The alpha transparency value for the color. - * @param strength The strength of the imprint or spread. - * @param inner Specifies whether the glow is an inner glow. - * @param knockout Specifies whether the object has a knockout effect. - * @param quality The number of times to apply the filter. - * @param remove If true, the filter will be removed as soon as the tween completes - * @param addFilter If true, a new GlowFilter will be added to the target even if a GlowFilter is already in its filters array. - * @param index Allows you to target a particular GlowFilter if there are multiple GlowFilters in the target's filters array - simply define the index value corresponding to the GlowFilter's position in the filters array. - * @return The TweenMaxVars instance - */ - public function glowFilter(blurX:Number=10, blurY:Number=10, color:uint=0xFFFFFF, alpha:Number=1, strength:Number=2, inner:Boolean=false, knockout:Boolean=false, quality:uint=2, remove:Boolean=false, addFilter:Boolean=false, index:int=-1):TweenMaxVars { - var filter:Object = {blurX:blurX, blurY:blurY, color:color, alpha:alpha, strength:strength, inner:inner, knockout:knockout, quality:quality, addFilter:addFilter, remove:remove}; - if (index > -1) { - filter.index = index; - } - return _set("glowFilter", filter, true); - } - - /** - * Although hex colors are technically numbers, if you try to tween them conventionally, - * you'll notice that they don't tween smoothly. To tween them properly, the red, green, and - * blue components must be extracted and tweened independently. The HexColorsPlugin makes it easy. - * To tween a property of your object that's a hex color to another hex color, just pass a hexColors - * Object with properties named the same as your object's hex color properties. For example, - * if myObject has a "myHexColor" property that you'd like to tween to red (0xFF0000) over the - * course of 2 seconds, you'd do: - * - *

- * TweenMax.to(myObject, 2, new TweenMaxVars().hexColors({myHexColor:0xFF0000})); - *

- * - *

You can pass in any number of hexColor properties.

- * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.HexColorsPlugin; - TweenPlugin.activate([HexColorsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(myObject, 2, new TweenMaxVars().hexColors({myHexColor:0xFF0000})); - - *

Or if you just want to tween a color and apply it somewhere on every frame, you could do:

- * - var myColor:Object = {hex:0xFF0000}; - TweenMax.to(myColor, 2, new TweenMaxVars().hexColors({hex:0x0000FF}).onUpdate(applyColor)); - function applyColor():void { - mc.graphics.clear(); - mc.graphics.beginFill(myColor.hex, 1); - mc.graphics.drawRect(0, 0, 100, 100); - mc.graphics.endFill(); - } - - * - **/ - public function hexColors(values:Object):TweenMaxVars { - return _set("hexColors", values, true); - } - - - /** - * MotionBlurPlugin provides an easy way to apply a directional blur to a DisplayObject based on its velocity - * and angle of movement in 2D (x/y). This creates a much more realistic effect than a standard BlurFilter for - * several reasons: - *
    - *
  1. A regular BlurFilter is limited to blurring horizontally and/or vertically whereas the motionBlur - * gets applied at the angle at which the object is moving.
  2. - * - *
  3. A BlurFilter tween has static start/end values whereas a motionBlur tween dynamically adjusts the - * values on-the-fly during the tween based on the velocity of the object. So if you use a Strong.easeInOut - * for example, the strength of the blur will start out low, then increase as the object moves faster, and - * reduce again towards the end of the tween.
  4. - *
- * - *

motionBlur even works on bezier/bezierThrough tweens!

- * - *

To accomplish the effect, MotionBlurPlugin creates a Bitmap that it places over the original object, changing - * alpha of the original to [almost] zero during the course of the tween. The original DisplayObject still follows the - * course of the tween, so MouseEvents are properly dispatched. You shouldn't notice any loss of interactivity. - * The DisplayObject can also have animated contents - MotionBlurPlugin automatically updates on every frame. - * Be aware, however, that as with most filter effects, MotionBlurPlugin is somewhat CPU-intensive, so it is not - * recommended that you tween large quantities of objects simultaneously. You can activate fastMode - * to significantly speed up rendering if the object's contents and size/color doesn't need to change during the - * course of the tween.

- * - * @param strength Determines the strength of the blur. The default is 1. For a more powerful blur, increase the number. Or reduce it to make the effect more subtle. - * @param fastMode Setting fastMode to true will significantly improve rendering performance but it is only appropriate for situations when the target object's contents, size, color, filters, etc. do not need to change during the course of the tween. It works by essentially taking a BitmapData snapshot of the target object at the beginning of the tween and then reuses that throughout the tween, blurring it appropriately. The default value for fastMode is false. - * @param quality The lower the quality, the less CPU-intensive the effect will be. Options are 1, 2, or 3. The default is 2. - * @param padding padding controls the amount of space around the edges of the target object that is included in the BitmapData capture (the default is 10 pixels). If the target object has filters applied to it like a GlowFilter or DropShadowFilter that extend beyond the bounds of the object itself, you might need to increase the padding to accommodate the filters. - * @return The TweenMaxVars instance - */ - public function motionBlur(strength:Number=1, fastMode:Boolean=false, quality:int=2, padding:int=10):TweenMaxVars { - return _set("motionBlur", {strength:strength, fastMode:fastMode, quality:quality, padding:padding}, true); - } - - /** - * A common effect that designers/developers want is for a MovieClip/Sprite to orient itself in the direction of - * a Bezier path (alter its rotation). orientToBezier makes it easy. In order to alter a rotation property accurately, - * TweenLite/Max needs 4 pieces of information: - *
    - *
  1. Position property 1 (typically "x")
  2. - *
  3. Position property 2 (typically "y")
  4. - *
  5. Rotational property (typically "rotation")
  6. - *
  7. Number of degrees to add (optional - makes it easy to orient your MovieClip/Sprite properly)
  8. - *
- * - *

The orientToBezier property should be an Array containing one Array for each set of these values. - * For maximum flexibility, you can pass in any number of Arrays inside the container Array, one for - * each rotational property. This can be convenient when working in 3D because you can rotate on multiple axis. - * If you're doing a standard 2D x/y tween on a bezier, you can simply pass in a boolean value of true and - * TweenMax will use a typical setup, [["x", "y", "rotation", 0]]. - * Hint: Don't forget the container Array (notice the double outer brackets)

- * - *

To use the default value ([["x", "y", "rotation", 0]]), you can simply leave the values parameter as null.

- */ - public function orientToBezier(values:Object=null):TweenMaxVars { - return _set("orientToBezier", (values == null) ? true : values, false); - } - - - /** - * Provides simple physics functionality for tweening a DisplayObject's x and y coordinates based on a - * combination of velocity, angle, gravity, acceleration, accelerationAngle, and/or friction. It is not intended - * to replace a full-blown physics engine and does not offer collision detection, but serves - * as a way to easily create interesting physics-based effects with the GreenSock tweening platform. Parameters - * are not intended to be dynamically updateable, but one unique convenience is that everything is reverseable. - * So if you spawn a bunch of particle tweens, for example, and throw them into a TimelineLite, you could - * simply call reverse() on the timeline to watch the particles retrace their steps right back to the beginning. - * Keep in mind that any easing equation you define for your tween will be completely ignored for these properties. - * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.Physics2DPlugin; - TweenPlugin.activate([Physics2DPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 2, new TweenMaxVars().physics2D(300, -60, 400)); - - * - *

Physics2DPlugin is a Club GreenSock membership benefit. You must have a valid membership to use this class - * without violating the terms of use. Visit http://www.greensock.com/club/ to sign up or get more details.

- * - * @param velocity The initial velocity of the object measured in pixels per time unit (usually seconds, but for tweens where useFrames is true, it would be measured in frames). The default is zero. - * @param angle The initial angle (in degrees) at which the object is traveling. Only pertinent when a velocity is defined. For example, if the object should start out traveling at -60 degrees (towards the upper right), the angle would be -60. The default is zero. - * @param acceleration The amount of acceleration applied to the object, measured in pixels per time unit (usually seconds, but for tweens where useFrames is true, it would be measured in frames). To apply the acceleration in a specific direction that is different than the angle, use the accelerationAngle property. - * @param accelerationAngle The angle at which acceleration is applied (if any), measured in degrees. So if, for example, you want the object to accelerate towards the left side of the screen, you'd use an accelerationAngle of 180. - * @param friction A value between 0 and 1 where 0 is no friction, 0.08 is a small amount of friction, and 1 will completely prevent any movement. This is not meant to be precise or scientific in any way, but rather serves as an easy way to apply a friction-like physics effect to your tween. Generally it is best to experiment with this number a bit. Also note that friction requires more processing than physics tweens without any friction. - * @return The TweenMaxVars instance - * @see #physicsProps() - */ - public function physics2D(velocity:Number, angle:Number, acceleration:Number=0, accelerationAngle:Number=90, friction:Number=0):TweenMaxVars { - return _set("physics2D", {velocity:velocity, angle:angle, acceleration:acceleration, accelerationAngle:accelerationAngle, friction:friction}, true); - } - - /** - * Sometimes you want to tween a property (or several) but you don't have a specific end value in mind - instead, - * you'd rather describe the movement in terms of physics concepts, like velocity, acceleration, - * and/or friction. physicsProps allows you to tween any numeric property of any object based - * on these concepts. Keep in mind that any easing equation you define for your tween will be completely - * ignored for these properties. Instead, the physics parameters will determine the movement/easing. - * These parameters, by the way, are not intended to be dynamically updateable, but one unique convenience - * is that everything is reverseable. So if you create several physics-based tweens, for example, and - * throw them into a TimelineLite, you could simply call reverse() on the timeline to watch the objects - * retrace their steps right back to the beginning. Here are the parameters you can define (note that - * friction and acceleration are both completely optional): - *
    - *
  • velocity : Number - the initial velocity of the object measured in units per time - * unit (usually seconds, but for tweens where useFrames is true, it would - * be measured in frames). The default is zero.
  • - *
  • acceleration : Number [optional] - the amount of acceleration applied to the object, measured - * in units per time unit (usually seconds, but for tweens where useFrames - * is true, it would be measured in frames). The default is zero.
  • - *
  • friction : Number [optional] - a value between 0 and 1 where 0 is no friction, 0.08 is a small amount of - * friction, and 1 will completely prevent any movement. This is not meant to be precise or - * scientific in any way, but rather serves as an easy way to apply a friction-like - * physics effect to your tween. Generally it is best to experiment with this number a bit. - * Also note that friction requires more processing than physics tweens without any friction.
  • - *
- * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.PhysicsPropsPlugin; - TweenPlugin.activate([PhysicsPropsPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 2, new TweenMaxVars().physicsProps({ - x:{velocity:100, acceleration:200}, - y:{velocity:-200, friction:0.1} - } - )); - - * - *

PhysicsPropsPlugin is a Club GreenSock membership benefit. You must have a valid membership to use this class - * without violating the terms of use. Visit http://www.greensock.com/club/ to sign up or get more details.

- * - * @see #physics2D() - **/ - public function physicsProps(values:Object):TweenMaxVars { - return _set("physicsProps", values, true); - } - - /** An object with properties that correspond to the quaternion properties of the target object. For example, if your my3DObject has "orientation" and "childOrientation" properties that contain quaternions, and you'd like to tween them both, you'd do: {orientation:myTargetQuaternion1, childOrientation:myTargetQuaternion2}. Quaternions must have the following properties: x, y, z, and w. **/ - public function quaternions(values:Object):TweenMaxVars { - return _set("quaternions", values, true); - } - - /** Removes the tint of a DisplayObject over time. **/ - public function removeTint(remove:Boolean=true):TweenMaxVars { - return _set("removeTint", remove, true); - } - - /** An array of the names of properties that should be rounded to the nearest integer when tweening. For example, ["x","y"] **/ - public function roundProps(propertyNames:Array):TweenMaxVars { - return _set("roundProps", propertyNames, true); - } - - /** - * Tweens the scrollRect property of a DisplayObject. You can define any (or all) of the following properties: - * - *
    - *
  • x : Number
  • - *
  • y : Number
  • - *
  • width : Number
  • - *
  • height : Number
  • - *
  • top : Number
  • - *
  • bottom : Number
  • - *
  • left : Number
  • - *
  • right : Number
  • - *
- *
- * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.ScrollRectPlugin; - TweenPlugin.activate([ScrollRectPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 1, new TweenMaxVars().scrollRect({x:50, y:300, width:100, height:100})); - - **/ - public function scrollRect(props:Object):TweenMaxVars { - return _set("scrollRect", props, true); - } - - /** - * Some components require resizing with setSize() instead of standard tweens of width/height in - * order to scale properly. The SetSizePlugin accommodates this easily. You can define the width, - * height, or both. - * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.SetSizePlugin; - TweenPlugin.activate([SetSizePlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(myComponent, 1, new TweenMaxVars().setSize(200, 30)); - - **/ - public function setSize(width:Number=NaN, height:Number=NaN):TweenMaxVars { - var values:Object = {}; - if (!isNaN(width)) { - values.width = width; - } - if (!isNaN(height)) { - values.height = height; - } - return _set("setSize", values, true); - } - - /** - * To tween any rotation property of the target object in the shortest direction, use "shortRotation" - * For example, if myObject.rotation is currently 170 degrees and you want to tween it to - * -170 degrees, a normal rotation tween would travel a total of 340 degrees in the counter-clockwise - * direction, but if you use shortRotation, it would travel 20 degrees in the clockwise direction instead. - * You can define any number of rotation properties in the shortRotation object which makes 3D tweening - * easier, like: - * - *

- * TweenMax.to(mc, 2, new TweenMaxVars().shortRotation({rotationX:-170, rotationY:35, rotationZ:200})); - *

- * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.ShortRotationPlugin; - TweenPlugin.activate([ShortRotationPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 1, new TweenMaxVars().shortRotation({rotation:-170})); - - //or for a 3D tween with multiple rotation values... - TweenMax.to(mc, 1, new TweenMaxVars().shortRotation({rotationX:-170, rotationY:35, rotationZ:10})); - - **/ - public function shortRotation(values:Object):TweenMaxVars { - if (typeof(values) == "number") { - values = {rotation:values}; - } - return _set("shortRotation", values, true); - } - - - /** - * Tweens properties of an object's soundTransform property (like the volume, pan, leftToRight, etc. - * of a MovieClip/SoundChannel/NetStream). - * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.SoundTransformPlugin; - TweenPlugin.activate([SoundTransformPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 1, new TweenMaxVars().soundTransform(0.2, 0.5)); - - * - * @param volume The volume, ranging from 0 (silent) to 1 (full volume). - * @param pan The left-to-right panning of the sound, ranging from -1 (full pan left) to 1 (full pan right). - * @param leftToLeft A value, from 0 (none) to 1 (all), specifying how much of the left input is played in the left speaker. - * @param leftToRight A value, from 0 (none) to 1 (all), specifying how much of the left input is played in the right speaker. - * @param rightToLeft A value, from 0 (none) to 1 (all), specifying how much of the right input is played in the left speaker. - * @param rightToRight A value, from 0 (none) to 1 (all), specifying how much of the right input is played in the right speaker. - * @return The TweenMaxVars instance - */ - public function soundTransform(volume:Number=1, pan:Number=0, leftToLeft:Number=1, leftToRight:Number=0, rightToLeft:Number=0, rightToRight:Number=1):TweenMaxVars { - return _set("soundTransform", {volume:volume, pan:pan, leftToLeft:leftToLeft, leftToRight:leftToRight, rightToLeft:rightToLeft, rightToRight:rightToRight}, true); - } - - /** - * Sets the stage's quality to a particular value during a tween and another value after - * the tween which can be useful for improving rendering performance in the Flash Player while things are animating. - * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.StageQualityPlugin; - import flash.display.StageQuality; - TweenPlugin.activate([StageQualityPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 1, new TweenMaxVars().prop("x", 100).stageQuality(this.stage, StageQuality.LOW, StageQuality.HIGH)); - - * - * @param stage A reference to the stage - * @param during The stage quality that should be used during the tween - * @param after The stage quality that should be set after the tween completes - * @return The TweenMaxVars instance - */ - public function stageQuality(stage:Stage, during:String="medium", after:String=null):TweenMaxVars { - if (after == null) { - after = stage.quality; - } - return _set("stageQuality", {stage:stage, during:during, after:after}, true); - } - - /** - * Allows you to define an initial velocity at which a property (or multiple properties) will start tweening, - * as well as [optional] maximum and/or minimum end values and then it will calculate the appropriate landing - * position and plot a smooth course to it based on the easing equation you define (Quad.easeOut by default, - * as set in TweenLite). This is perfect for flick-scrolling or animating things as though they are being thrown. - * - *

In its simplest form, you can pass just the initial velocity for each property like this: - * {x:500, y:-300}

- * - *

In the above example, x will animate at 500 pixels per second initially and - * y will animate at -300 pixels per second. Both will decelerate smoothly - * until they come to rest based on the tween's duration.

- * - *

To impose maximum and minimum boundaries on the end values, use the nested object syntax - * with the max and min special properties like this: - * {x:{velocity:500, max:1024, min:0}, y:{velocity:-300, max:720, min:0}}; - *

- * - *

Notice the nesting of the objects ({}). The max and min values refer - * to the range for the final resting position (coordinates in this case), NOT the velocity. - * So x would always land between 0 and 1024 in this case, and y - * would always land between 0 and 720. If you want the target object to land on a specific value - * rather than within a range, simply set max and min to identical values. - * Also notice that you must define a velocity value for each property in the object syntax.

- * - *

throwProps isn't just for tweening x and y coordinates. It works with any numeric - * property, so you could use it for spinning the rotation of an object as well. Or the - * scaleX/scaleY properties. Maybe the user drags to spin a wheel and - * lets go and you want it to continue increasing the rotation at that velocity, - * decelerating smoothly until it stops.

- * - *

ThrowPropsPlugin is a Club GreenSock membership benefit. - * You must have a valid membership to use this class without violating the terms of use. Visit - * http://www.greensock.com/club/ to sign up or get more details.

- **/ - public function throwProps(props:Object):TweenMaxVars { - return _set("throwProps", props, true); - } - - /** - * To change a DisplayObject's tint, set this to the hex value of the color you'd like the DisplayObject - * to end up at (or begin at if you're using TweenMax.from()). An example hex value would be 0xFF0000. - * If you'd like to remove the tint from a DisplayObject, use the removeTint special property. - * @see #removeTint() - * @see #colorMatrixFilter() - * @see #colorTransform() - **/ - public function tint(color:uint):TweenMaxVars { - return _set("tint", color, true); - } - - /** - * Normally, all transformations (scale, rotation, and position) are based on the DisplayObject's registration - * point (most often its upper left corner), but TransformAroundCenter allows you to make the transformations - * occur around the DisplayObject's center. - * - *

If you define an x or y value in the transformAroundCenter object, it will correspond to the center which - * makes it easy to position (as opposed to having to figure out where the original registration point - * should tween to). If you prefer to define the x/y in relation to the original registration point, do so outside - * the transformAroundCenter object, like:

- * - *

- * TweenMax.to(mc, 3, new TweenMaxVars().prop("x", 50).prop("y", 40).transformAroundCenter({scale:0.5, rotation:30})); - *

- * - *

TransformAroundCenterPlugin is a Club GreenSock membership benefit. - * You must have a valid membership to use this class without violating the terms of use. Visit - * http://www.greensock.com/club/ to sign up or get more details.

- * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.TransformAroundCenterPlugin; - TweenPlugin.activate([TransformAroundCenterPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 1, new TweenMaxVars().transformAroundCenter({scale:1.5, rotation:150})); - - * @see #transformAroundPoint() - **/ - public function transformAroundCenter(props:Object):TweenMaxVars { - return _set("transformAroundCenter", props, true); - } - - /** - * Normally, all transformations (scale, rotation, and position) are based on the DisplayObject's registration - * point (most often its upper left corner), but TransformAroundPoint allows you to define ANY point around which - * transformations will occur during the tween. For example, you may have a dynamically-loaded image that you - * want to scale from its center or rotate around a particular point on the stage. - * - *

If you define an x or y value in the transformAroundPoint object, it will correspond to the custom registration - * point which makes it easy to position (as opposed to having to figure out where the original registration point - * should tween to). If you prefer to define the x/y in relation to the original registration point, do so outside - * the transformAroundPoint object, like:

- * - *

- * TweenMax.to(mc, 3, new TweenMaxVars().prop("x", 50).prop("y", 40).transformAroundPoint(new Point(200, 300), {scale:0.5, rotation:30})); - *

- * - *

TransformAroundPointPlugin is a Club GreenSock membership benefit. - * You must have a valid membership to use this class without violating the terms of use. Visit - * http://www.greensock.com/club/ to sign up or get more details.

- * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.TransformAroundPointPlugin; - TweenPlugin.activate([TransformAroundPointPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 1, new TweenMaxVars().transformAroundPoint(new Point(100, 300), {scaleX:2, scaleY:1.5, rotation:150})); - - * @see #transformAroundCenter() - **/ - public function transformAroundPoint(point:Point, props:Object):TweenMaxVars { - props.point = point; - return _set("transformAroundPoint", props, true); - } - - /** - * transformMatrix tweens a DisplayObject's transform.matrix values directly either using - * the standard matrix properties (a, b, c, d, tx, and ty) or common properties - * like x, y, scaleX, scaleY, skewX, skewY, rotation and even shortRotation. - * To skew without adjusting scale visually, use skewX2 and skewY2 instead of skewX and skewY. - * - * - *

transformMatrix tween will affect all of the DisplayObject's transform properties, so do not use - * it in conjunction with regular x/y/scaleX/scaleY/rotation tweens concurrently.

- * - *

USAGE:

- * - import com.greensock.TweenMax; - import com.greensock.data.TweenMaxVars; - import com.greensock.plugins.TweenPlugin; - import com.greensock.plugins.TransformMatrixPlugin; - TweenPlugin.activate([TransformMatrixPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - - TweenMax.to(mc, 1, new TweenMaxVars().transformMatrix({x:50, y:300, scaleX:2, scaleY:2})); - - //-OR- - - TweenMax.to(mc, 1, new TweenMaxVars().transformMatrix({tx:50, ty:300, a:2, d:2})); - - **/ - public function transformMatrix(properties:Object):TweenMaxVars { - return _set("transformMatrix", properties, true); - } - - /** Sets a DisplayObject's "visible" property at the end of the tween. **/ - public function visible(value:Boolean):TweenMaxVars { - return _set("visible", value, true); - } - - /** Changes the volume of any object that has a soundTransform property (MovieClip, SoundChannel, NetStream, etc.) **/ - public function volume(volume:Number):TweenMaxVars { - return _set("volume", volume, true); - } - - -//---- GETTERS / SETTERS ------------------------------------------------------------------------------------------------------------- - - /** The generic object populated by all of the method calls in the TweenMaxVars instance. This is the raw data that gets passed to the tween. **/ - public function get vars():Object { - return _vars; - } - - /** @private **/ - public function get _isGSVars():Boolean { - return true; - } - - } -} \ No newline at end of file diff --git a/src/com/greensock/plugins/CirclePath2DPlugin.as b/src/com/greensock/plugins/CirclePath2DPlugin.as deleted file mode 100644 index 5a9b7e9c..00000000 --- a/src/com/greensock/plugins/CirclePath2DPlugin.as +++ /dev/null @@ -1,132 +0,0 @@ -/** - * VERSION: 12.0 - * DATE: 2012-01-12 - * AS3 - * UPDATES AND DOCS AT: http://www.greensock.com - **/ -package com.greensock.plugins { - import com.greensock.TweenLite; - import com.greensock.motionPaths.CirclePath2D; - import com.greensock.motionPaths.PathFollower; - import flash.geom.Matrix; -/** - * [AS3 only] Tweens an object along a CirclePath2D motion path in any direction (clockwise, counter-clockwise, or shortest). - * The plugin recognizes the following properties: - *
    - *
  • path : CirclePath2D - The CirclePath2D instance to follow (com.greensock.motionPaths.CirclePath2D)
  • - *
  • startAngle : Number - The position at which the target should begin its rotation (described - * in degrees unless useRadians is true in which case it is described in radians). - * For example, to begin at the top of the circle, use 270 or -90 as the startAngle.
  • - *
  • endAngle : Number - The position at which the target should end its rotation (described in - * degrees unless useRadians is true in which case it is described in radians). - * For example, to end at the bottom of the circle, use 90 as the endAngle
  • - *
  • autoRotate : Boolean - When autoRotate is true, the target will automatically - * be rotated so that it is oriented to the angle of the path. To offset this value (like to always add - * 90 degrees for example), use the rotationOffset property.
  • - *
  • rotationOffset : Number - When autoRotate is true, this value will always - * be added to the resulting rotation of the target.
  • - *
  • direction : String - The direction in which the target should travel around the path. Options are - * Direction.CLOCKWISE ("clockwise"), Direction.COUNTER_CLOCKWISE - * ("counterClockwise"), or Direction.SHORTEST ("shortest").
  • - *
  • extraRevolutions : uint - If instead of going directly to the endAngle, you want the target to - * travel one or more extra revolutions around the path before going to the endAngle, - * define that number of revolutions here.
  • - *
  • useRadians : Boolean - If you prefer to define values in radians instead of degrees, set useRadians to true.
  • - *
- * - * - * - *

USAGE:

- * -import com.greensock.~~; -import com.greensock.plugins.~~; -import com.greensock.motionPaths.~~; -TweenPlugin.activate([CirclePath2DPlugin]); //activation is permanent in the SWF, so this line only needs to be run once. - -var circle:CirclePath2D = new CirclePath2D(150, 150, 100); -TweenLite.to(mc, 2, {circlePath2D:{path:circle, startAngle:90, endAngle:270, direction:Direction.CLOCKWISE, extraRevolutions:2}}); - - * - *

Copyright 2008-2014, GreenSock. All rights reserved. This work is subject to the terms in http://www.greensock.com/terms_of_use.html or for Club GreenSock members, the software agreement that was issued with the membership.

- * - * @author Jack Doyle, jack@greensock.com - */ - public class CirclePath2DPlugin extends TweenPlugin { - /** @private **/ - public static const API:Number = 2; //If the API/Framework for plugins changes in the future, this number helps determine compatibility - /** @private **/ - private static const _2PI:Number = Math.PI * 2; - /** @private **/ - private static const _RAD2DEG:Number = 180 / Math.PI; - - /** @private **/ - protected var _target:Object; - /** @private **/ - protected var _autoRemove:Boolean; - /** @private **/ - protected var _start:Number; - /** @private **/ - protected var _change:Number; - /** @private **/ - protected var _circle:CirclePath2D; - /** @private **/ - protected var _autoRotate:Boolean; - /** @private **/ - protected var _rotationOffset:Number; - - /** @private **/ - public function CirclePath2DPlugin() { - super("circlePath2D,x,y"); - } - - /** @private **/ - override public function _onInitTween(target:Object, value:*, tween:TweenLite):Boolean { - if (!("path" in value) || !(value.path is CirclePath2D)) { - trace("CirclePath2DPlugin error: invalid 'path' property. Please define a CirclePath2D instance."); - return false; - } - _target = target; - _circle = value.path as CirclePath2D; - _autoRotate = Boolean(value.autoRotate == true); - _rotationOffset = value.rotationOffset || 0; - - var f:PathFollower = _circle.getFollower(target); - if (f != null && !("startAngle" in value)) { - _start = f.progress; - } else { - _start = _circle.angleToProgress(value.startAngle || 0, value.useRadians); - _circle.renderObjectAt(_target, _start); - } - _change = Number(_circle.anglesToProgressChange(_circle.progressToAngle(_start), value.endAngle || 0, value.direction || "clockwise", value.extraRevolutions || 0, Boolean(value.useRadians))); - return true; - } - - /** @private **/ - override public function _kill(lookup:Object):Boolean { - if (("x" in lookup) || ("y" in lookup)) { - _overwriteProps = []; - } - return super._kill(lookup); - } - - /** @private **/ - override public function setRatio(v:Number):void { - var angle:Number = (_start + (_change * v)) * _2PI, - radius:Number = _circle.radius, - m:Matrix = _circle.transform.matrix, - px:Number = Math.cos(angle) * radius, - py:Number = Math.sin(angle) * radius; - - _target.x = px * m.a + py * m.c + m.tx; - _target.y = px * m.b + py * m.d + m.ty; - - if (_autoRotate) { - angle += Math.PI / 2; - px = Math.cos(angle) * _circle.radius; - py = Math.sin(angle) * _circle.radius; - _target.rotation = Math.atan2(px * m.b + py * m.d, px * m.a + py * m.c) * _RAD2DEG + _rotationOffset; - } - } - - } -} \ No newline at end of file