move effects folders
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/c99bd398 Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c99bd398 Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c99bd398 Branch: refs/heads/mavenfolders Commit: c99bd39854e685580fe63471b5483fdb35a1978d Parents: 65ab7f3 Author: Alex Harui <[email protected]> Authored: Tue Feb 2 16:57:42 2016 -0800 Committer: Alex Harui <[email protected]> Committed: Tue Feb 2 16:57:42 2016 -0800 ---------------------------------------------------------------------- .../projects/Effects/as/src/EffectsClasses.as | 38 -- .../flex/core/StatesWithTransitionsImpl.as | 346 ---------- .../as/src/org/apache/flex/effects/Effect.as | 263 -------- .../as/src/org/apache/flex/effects/Fade.as | 165 ----- .../as/src/org/apache/flex/effects/IEffect.as | 136 ---- .../as/src/org/apache/flex/effects/Move.as | 240 ------- .../as/src/org/apache/flex/effects/Parallel.as | 152 ----- .../org/apache/flex/effects/PlatformWiper.as | 138 ---- .../as/src/org/apache/flex/effects/Resize.as | 197 ------ .../as/src/org/apache/flex/effects/Sequence.as | 152 ----- .../as/src/org/apache/flex/effects/Tween.as | 665 ------------------- .../as/src/org/apache/flex/effects/Wipe.as | 156 ----- .../as/src/org/apache/flex/states/Transition.as | 80 --- frameworks/projects/Effects/basic-manifest.xml | 32 - .../projects/Effects/compile-asjs-config.xml | 79 --- frameworks/projects/Effects/compile-config.xml | 78 --- .../Effects/src/main/flex/EffectsClasses.as | 38 ++ .../flex/core/StatesWithTransitionsImpl.as | 346 ++++++++++ .../main/flex/org/apache/flex/effects/Effect.as | 263 ++++++++ .../main/flex/org/apache/flex/effects/Fade.as | 165 +++++ .../flex/org/apache/flex/effects/IEffect.as | 136 ++++ .../main/flex/org/apache/flex/effects/Move.as | 240 +++++++ .../flex/org/apache/flex/effects/Parallel.as | 152 +++++ .../org/apache/flex/effects/PlatformWiper.as | 138 ++++ .../main/flex/org/apache/flex/effects/Resize.as | 197 ++++++ .../flex/org/apache/flex/effects/Sequence.as | 152 +++++ .../main/flex/org/apache/flex/effects/Tween.as | 665 +++++++++++++++++++ .../main/flex/org/apache/flex/effects/Wipe.as | 156 +++++ .../flex/org/apache/flex/states/Transition.as | 80 +++ .../src/main/resources/basic-manifest.xml | 32 + .../src/main/resources/compile-asjs-config.xml | 79 +++ .../src/main/resources/compile-config.xml | 78 +++ 32 files changed, 2917 insertions(+), 2917 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/EffectsClasses.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/EffectsClasses.as b/frameworks/projects/Effects/as/src/EffectsClasses.as deleted file mode 100644 index 4b529e8..0000000 --- a/frameworks/projects/Effects/as/src/EffectsClasses.as +++ /dev/null @@ -1,38 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package -{ - -/** - * @private - * This class is used to link additional classes into rpc.swc - * beyond those that are found by dependecy analysis starting - * from the classes specified in manifest.xml. - */ -internal class EffectsClasses -{ - import org.apache.flex.core.StatesWithTransitionsImpl; StatesWithTransitionsImpl; - import org.apache.flex.effects.Fade; Fade; - import org.apache.flex.effects.Move; Move; - import org.apache.flex.effects.PlatformWiper; PlatformWiper; - import org.apache.flex.effects.Tween; Tween; -} - -} - http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/core/StatesWithTransitionsImpl.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/core/StatesWithTransitionsImpl.as b/frameworks/projects/Effects/as/src/org/apache/flex/core/StatesWithTransitionsImpl.as deleted file mode 100644 index 9549bc8..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/core/StatesWithTransitionsImpl.as +++ /dev/null @@ -1,346 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// -package org.apache.flex.core -{ - - import org.apache.flex.core.IParent; - import org.apache.flex.core.IStatesObject; - import org.apache.flex.effects.Effect; - import org.apache.flex.events.Event; - import org.apache.flex.events.EventDispatcher; - import org.apache.flex.events.IEventDispatcher; - import org.apache.flex.events.ValueChangeEvent; - import org.apache.flex.states.AddItems; - import org.apache.flex.states.SetEventHandler; - import org.apache.flex.states.SetProperty; - import org.apache.flex.states.State; - import org.apache.flex.states.Transition; - import org.apache.flex.utils.MXMLDataInterpreter; - - /** - * The StatesWithTransitionsImpl class implements a set of - * view state functionality that includes transitions between states. - * It only supports AddItems and SetProperty and SetEventHandler - * changes at this time. - * - * @flexjsignoreimport org.apache.flex.core.IStatesObject - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public class StatesWithTransitionsImpl extends EventDispatcher implements IStatesImpl, IBead - { - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function StatesWithTransitionsImpl() - { - super(); - } - - private var _strand:IStrand; - - private var sawInitComplete:Boolean; - - /** - * @copy org.apache.flex.core.IBead#strand - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ - public function set strand(value:IStrand):void - { - _strand = value; - IEventDispatcher(_strand).addEventListener("currentStateChange", stateChangeHandler); - IEventDispatcher(_strand).addEventListener("initComplete", initialStateHandler); - } - - /** - * @private - * @flexjsignorecoercion org.apache.flex.core.IStatesObject - */ - private function initialStateHandler(event:org.apache.flex.events.Event):void - { - sawInitComplete = true; - stateChangeHandler(new ValueChangeEvent("currentStateChange", false, false, null, - IStatesObject(_strand).currentState)); - } - - /** - * @private - * @flexjsignorecoercion org.apache.flex.core.IStatesObject - */ - private function stateChangeHandler(event:ValueChangeEvent):void - { - if (!sawInitComplete) - return; - - var doc:IStatesObject = _strand as IStatesObject; - var transitions:Array = doc.transitions; - if (transitions && transitions.length > 0) - { - for each (var t:Transition in transitions) - { - if (t.fromState == "*" || t.fromState == event.oldValue) - { - if (t.toState == "*" || t.toState == event.newValue) - { - transitionEffects = t.effects.slice(); - for each (var e:Effect in transitionEffects) - { - e.captureStartValues(); - } - break; - } - } - } - } - var arr:Array = doc.states; - var oldState:State; - var newState:State; - for each (var s:State in arr) - { - if (s.name == event.oldValue) - { - oldState = s; - break; - } - } - for each (s in arr) - { - if (s.name == event.newValue) - { - newState = s; - break; - } - } - if (oldState) - revert(oldState, newState); - if (newState) - apply(oldState, newState); - if (transitionEffects && transitionEffects.length > 0) - { - for each (e in transitionEffects) - { - e.captureEndValues(); - } - } - var playingTransition:Boolean; - if (transitionEffects && transitionEffects.length > 0) - { - playingTransition = true; - for each (e in transitionEffects) - { - e.addEventListener(Effect.EFFECT_END, effectEndHandler); - e.play(); - } - } - if (!playingTransition) - doc.dispatchEvent(new Event("stateChangeComplete")); - } - - private var transitionEffects:Array; - - /** - * @private - * @flexjsignorecoercion org.apache.flex.core.IStatesObject - */ - private function effectEndHandler(event:Event):void - { - // in case of extraneous calls to effectEndHandler - if (transitionEffects == null) - return; - - var n:int = transitionEffects.length; - for (var i:int = 0; i < n; i++) - { - event.target.removeEventListener(Effect.EFFECT_END, effectEndHandler); - if (transitionEffects[i] == event.target) - transitionEffects.splice(i, 1); - } - if (transitionEffects.length == 0) - { - transitionEffects = null; - var doc:IStatesObject = _strand as IStatesObject; - doc.dispatchEvent(new Event("stateChangeComplete")); - } - } - - private function isItemInState(child:Object, s:State):Boolean - { - if (s == null) return false; - - var arr:Array = s.overrides; - for each (var o:Object in arr) - { - if (o is AddItems) - { - var ai:AddItems = AddItems(o); - if (ai.items == null) - { - ai.items = ai.itemsDescriptor.items as Array; - if (ai.items == null) - { - ai.items = - MXMLDataInterpreter.generateMXMLArray(ai.document, - null, ai.itemsDescriptor.descriptor); - ai.itemsDescriptor.items = ai.items; - } - } - for each (var item:IChild in ai.items) - { - if (item == child) - return true; - } - } - } - return false; - } - - private function revert(s:State, newState:State):void - { - var arr:Array = s.overrides; - for each (var o:Object in arr) - { - if (o is AddItems) - { - var ai:AddItems = AddItems(o); - var childrenAdded:Boolean = false; - for each (var item:IChild in ai.items) - { - if (!isItemInState(item, newState)) - { - var parent:IParent = item.parent as IParent; - parent.removeElement(item); - childrenAdded = true; - } - } - if (childrenAdded && parent is IContainer) - IContainer(parent).childrenAdded(); - } - else if (o is SetProperty) - { - var sp:SetProperty = SetProperty(o); - if (sp.target != null) - sp.document[sp.target][sp.name] = sp.previousValue; - else - sp.document[sp.name] = sp.previousValue; - } - else if (o is SetEventHandler) - { - var seh:SetEventHandler = SetEventHandler(o); - if (seh.target != null) - { - seh.document[seh.target].removeEventListener(seh.name, seh.handlerFunction); - } - else - { - seh.document.removeEventListener(seh.name, seh.handlerFunction); - } - } - } - } - - private function apply(oldState:State, s:State):void - { - var arr:Array = s.overrides; - for each (var o:Object in arr) - { - if (o is AddItems) - { - var ai:AddItems = AddItems(o); - if (ai.items == null) - { - ai.items = ai.itemsDescriptor.items as Array; - if (ai.items == null) - { - ai.items = - MXMLDataInterpreter.generateMXMLArray(ai.document, - null, ai.itemsDescriptor.descriptor); - ai.itemsDescriptor.items = ai.items; - } - } - var childrenAdded:Boolean = false; - for each (var item:Object in ai.items) - { - if (!isItemInState(item, oldState)) - { - var parent:IParent = ai.document as IParent; - if (ai.destination) - parent = parent[ai.destination] as IParent; - if (ai.relativeTo != null) - { - var child:Object = ai.document[ai.relativeTo]; - if (ai.destination) - parent = IChild(child).parent as IParent; - var index:int = parent.getElementIndex(child); - if (ai.position == "after") - index++; - parent.addElementAt(item, index); - childrenAdded = true; - } - else - { - parent.addElement(item); - childrenAdded = true; - } - } - } - if (childrenAdded && parent is IContainer) - IContainer(parent).childrenAdded(); - } - else if (o is SetProperty) - { - var sp:SetProperty = SetProperty(o); - if (sp.target != null) - { - sp.previousValue = sp.document[sp.target][sp.name]; - sp.document[sp.target][sp.name] = sp.value; - } - else - { - sp.previousValue = sp.document[sp.name]; - sp.document[sp.name] = sp.value; - } - } - else if (o is SetEventHandler) - { - var seh:SetEventHandler = SetEventHandler(o); - if (seh.target != null) - { - seh.document[seh.target].addEventListener(seh.name, seh.handlerFunction); - } - else - { - seh.document.addEventListener(seh.name, seh.handlerFunction); - } - } - } - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/Effect.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Effect.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/Effect.as deleted file mode 100644 index 7fabe6a..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Effect.as +++ /dev/null @@ -1,263 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -import org.apache.flex.events.EventDispatcher; - -/** - * Effect is the base class for effects in FlexJS. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public class Effect extends EventDispatcher implements IEffect -{ - //-------------------------------------------------------------------------- - // - // Class constants - // - //-------------------------------------------------------------------------- - - /** - * The <code>Effect.EFFECT_END</code> constant defines the value of the - * event object's <code>type</code> property for a <code>effectEnd</code> event. - * - * <p>The properties of the event object have the following values:</p> - * <table class="innertable"> - * <tr><th>Property</th><th>Value</th></tr> - * <tr><td><code>bubbles</code></td><td>false</td></tr> - * <tr><td><code>cancelable</code></td><td>false</td></tr> - * <tr><td><code>currentTarget</code></td><td>The Object that defines the - * event listener that handles the event. For example, if you use - * <code>myButton.addEventListener()</code> to register an event listener, - * myButton is the value of the <code>currentTarget</code>. </td></tr> - * <tr><td><code>target</code></td><td>The Object that dispatched the event; - * it is not always the Object listening for the event. - * Use the <code>currentTarget</code> property to always access the - * Object listening for the event.</td></tr> - * </table> - * - * @eventType effectEnd - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public static const EFFECT_END:String = "effectEnd"; - - /** - * The <code>Effect.EFFECT_START</code> constant defines the value of the - * event object's <code>type</code> property for a <code>effectStart</code> event. - * - * <p>The properties of the event object have the following values:</p> - * <table class="innertable"> - * <tr><th>Property</th><th>Value</th></tr> - * <tr><td><code>bubbles</code></td><td>false</td></tr> - * <tr><td><code>cancelable</code></td><td>false</td></tr> - * <tr><td><code>currentTarget</code></td><td>The Object that defines the - * event listener that handles the event. For example, if you use - * <code>myButton.addEventListener()</code> to register an event listener, - * myButton is the value of the <code>currentTarget</code>. </td></tr> - * <tr><td><code>target</code></td><td>The Object that dispatched the event; - * it is not always the Object listening for the event. - * Use the <code>currentTarget</code> property to always access the - * Object listening for the event.</td></tr> - * </table> - * - * @eventType effectStart - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public static const EFFECT_START:String = "effectStart"; - - /** - * The <code>Effect.EFFECT_STOP</code> constant defines the value of the - * event object's <code>type</code> property for a <code>effectStop</code> event. - * - * <p>The properties of the event object have the following values:</p> - * <table class="innertable"> - * <tr><th>Property</th><th>Value</th></tr> - * <tr><td><code>bubbles</code></td><td>false</td></tr> - * <tr><td><code>cancelable</code></td><td>false</td></tr> - * <tr><td><code>currentTarget</code></td><td>The Object that defines the - * event listener that handles the event. For example, if you use - * <code>myButton.addEventListener()</code> to register an event listener, - * myButton is the value of the <code>currentTarget</code>. </td></tr> - * <tr><td><code>target</code></td><td>The Object that dispatched the event; - * it is not always the Object listening for the event. - * Use the <code>currentTarget</code> property to always access the - * Object listening for the event.</td></tr> - * </table> - * - * @eventType effectStop - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public static const EFFECT_STOP:String = "effectStop"; - - - - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function Effect() - { - } - - //-------------------------------------------------------------------------- - // - // Properties - // - //-------------------------------------------------------------------------- - - //---------------------------------- - // duration - //---------------------------------- - - private var _duration:Number = 500; - /** - * Duration of the animation, in milliseconds. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function get duration():Number - { - return _duration; - } - public function set duration(value:Number):void - { - _duration = value; - } - - - /** - * Plays the effect in reverse, - * starting from the current position of the effect. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function reverse():void - { - } - - /** - * Pauses the effect until you call the <code>resume()</code> method. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function pause():void - { - } - - /** - * Stops the tween, ending it without dispatching an event or calling - * the Tween's endFunction or <code>onTweenEnd()</code>. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function play():void - { - } - - /** - * Stops the tween, ending it without dispatching an event or calling - * the Tween's endFunction or <code>onTweenEnd()</code>. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function stop():void - { - } - - /** - * Resumes the effect after it has been paused - * by a call to the <code>pause()</code> method. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function resume():void - { - } - - /** - * @copy org.apache.flex.effects.IEffect#captureStartValues - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function captureStartValues():void - { - } - - /** - * @copy org.apache.flex.effects.IEffect#captureEndValues - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function captureEndValues():void - { - } -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/Fade.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Fade.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/Fade.as deleted file mode 100644 index 28f0d16..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Fade.as +++ /dev/null @@ -1,165 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -import org.apache.flex.core.IDocument; -import org.apache.flex.core.IUIBase; - -/** - * The Fade effect animates a UI component's alpha or opacity. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public class Fade extends Tween implements IDocument -{ - - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * Constructor. - * - * @param target An object that will - * have its x and/or y property animated. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function Fade(target:IUIBase = null) - { - super(); - - this.actualTarget = target; - startValue = 0; - endValue = 1; - - listener = this; - } - - //-------------------------------------------------------------------------- - // - // Variables - // - //-------------------------------------------------------------------------- - - /** - * @private - * The document. - */ - private var document:Object; - - /** - * @private - * The target. - */ - private var actualTarget:IUIBase; - - /** - * The target as the String id - * of a widget in an MXML Document. - */ - public var target:String; - - /** - * @private - * The change in alpha. - */ - private var d:Number; - - /** - * @private - * The starting value. - */ - private var start:Number; - - /** - * Starting alpha value. If NaN, the current alpha value is used - */ - public var alphaFrom:Number; - - /** - * Ending alpha value. If NaN, the current alpha value is not changed - */ - public var alphaTo:Number; - - - - //-------------------------------------------------------------------------- - // - // Properties - // - //-------------------------------------------------------------------------- - - - //-------------------------------------------------------------------------- - // - // Methods - // - //-------------------------------------------------------------------------- - - public function setDocument(document:Object, id:String = null):void - { - this.document = document; - } - - /** - * @private - */ - override public function play():void - { - if (target != null) - actualTarget = document[target]; - - if (isNaN(alphaFrom)) - start = actualTarget.alpha; - else - start = alphaFrom; - - if (isNaN(alphaTo)) - d = 0; - else - d = alphaTo - start; - - super.play(); - } - - public function onTweenUpdate(value:Number):void - { - if (d) - actualTarget.alpha = start + value * d; - } - - public function onTweenEnd(value:Number):void - { - if (d) - actualTarget.alpha = start + d; - } -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/IEffect.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/IEffect.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/IEffect.as deleted file mode 100644 index f5b940c..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/IEffect.as +++ /dev/null @@ -1,136 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -import org.apache.flex.events.IEventDispatcher; - -/** - * IEffect is the lowest-level interface for effects in FlexJS. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public interface IEffect extends IEventDispatcher -{ - - - //-------------------------------------------------------------------------- - // - // Properties - // - //-------------------------------------------------------------------------- - - //---------------------------------- - // duration - //---------------------------------- - - /** - * Duration of the animation, in milliseconds. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function get duration():Number; - function set duration(value:Number):void; - - - /** - * Plays the effect in reverse, - * starting from the current position of the effect. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function reverse():void; - - /** - * Pauses the effect until you call the <code>resume()</code> method. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function pause():void; - - /** - * Stops the tween, ending it without dispatching an event or calling - * the Tween's endFunction or <code>onTweenEnd()</code>. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function play():void; - - /** - * Stops the tween, ending it without dispatching an event or calling - * the Tween's endFunction or <code>onTweenEnd()</code>. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function stop():void; - - /** - * Resumes the effect after it has been paused - * by a call to the <code>pause()</code> method. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function resume():void; - - /** - * Tries to compute initial values - * for effect - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function captureStartValues():void; - - /** - * Tries to compute final values - * for effect - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - function captureEndValues():void; -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/Move.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Move.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/Move.as deleted file mode 100644 index 2a42b19..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Move.as +++ /dev/null @@ -1,240 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -import org.apache.flex.core.IDocument; -import org.apache.flex.core.IUIBase; - -/** - * The Move effect animates a UI component's x or y position. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public class Move extends Tween implements IDocument -{ - - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * Constructor. - * - * @param target Object ID or reference to an object that will - * have its x and/or y property animated. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function Move(target:IUIBase = null) - { - super(); - - this.actualTarget = target; - startValue = 0; - endValue = 1; - - listener = this; - } - - //-------------------------------------------------------------------------- - // - // Variables - // - //-------------------------------------------------------------------------- - - /** - * @private - * The document. - */ - private var document:Object; - - /** - * @private - * The actual target. - */ - private var actualTarget:IUIBase; - - /** - * The target as the String id - * of a widget in an MXML Document. - */ - public var target:String; - - /** - * The change in x. - */ - public var xBy:Number; - - /** - * The change in y. - */ - public var yBy:Number; - - /** - * @private - * The starting x. - */ - private var xStart:Number; - - /** - * @private - * The starting y. - */ - private var yStart:Number; - - /** - * @private - * The total change for x. - */ - private var xMove:Number; - - /** - * @private - * The total change for y. - */ - private var yMove:Number; - - /** - * Starting x value. If NaN, the current x value is used - */ - public var xFrom:Number; - - /** - * Ending x value. If NaN, the current x value is not changed - */ - public var xTo:Number; - - /** - * Starting y value. If NaN, the current y value is used - */ - public var yFrom:Number; - - /** - * Ending y value. If NaN, the current y value is not changed - */ - public var yTo:Number; - - - //-------------------------------------------------------------------------- - // - // Properties - // - //-------------------------------------------------------------------------- - - - //-------------------------------------------------------------------------- - // - // Methods - // - //-------------------------------------------------------------------------- - - public function setDocument(document:Object, id:String = null):void - { - this.document = document; - } - - /** - * @private - */ - override public function play():void - { - if (target != null) - actualTarget = document[target]; - - if (isNaN(xFrom)) - xStart = actualTarget.x; - else - xStart = xFrom; - - if (isNaN(xBy)) - { - if (isNaN(xTo)) - xMove = 0; - else - xMove = xTo - xStart; - } - else - xMove = xBy; - - if (isNaN(yFrom)) - yStart = actualTarget.y; - else - yStart = yFrom; - if (isNaN(yBy)) - { - if (isNaN(yTo)) - yMove = 0; - else - yMove = yTo - yStart; - } - else - yMove = yBy; - - super.play(); - } - - public function onTweenUpdate(value:Number):void - { - if (xMove) - actualTarget.x = xStart + value * xMove; - if (yMove) - actualTarget.y = yStart + value * yMove; - } - - public function onTweenEnd(value:Number):void - { - if (xMove) - actualTarget.x = xStart + xMove; - if (yMove) - actualTarget.y = yStart + yMove; - - } - - override public function captureStartValues():void - { - if (target != null) - { - actualTarget = document[target]; - xFrom = actualTarget.x; - yFrom = actualTarget.y; - } - } - - override public function captureEndValues():void - { - if (target != null) - { - actualTarget = document[target]; - xTo = actualTarget.x; - yTo = actualTarget.y; - } - } -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/Parallel.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Parallel.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/Parallel.as deleted file mode 100644 index 6d08012..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Parallel.as +++ /dev/null @@ -1,152 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -import org.apache.flex.core.IDocument; -import org.apache.flex.core.IUIBase; -import org.apache.flex.events.Event; - -[DefaultProperty("children")] - -/** - * The Parallel effect animates set of effects at the - * same time. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public class Parallel extends Effect implements IDocument -{ - - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function Parallel() - { - super(); - } - - //-------------------------------------------------------------------------- - // - // Variables - // - //-------------------------------------------------------------------------- - - /** - * @private - * The document. - */ - private var document:Object; - - /** - * @private - * The target. - */ - private var target:IUIBase; - - /** - * The children. - */ - public var children:Array; - - - - //-------------------------------------------------------------------------- - // - // Properties - // - //-------------------------------------------------------------------------- - - /** - * @private - */ - override public function set duration(value:Number):void - { - var n:int = children.length; - for (var i:int = 0; i < 0; i++) - { - children[i].duration = value; - } - super.duration = value; - } - - //-------------------------------------------------------------------------- - // - // Methods - // - //-------------------------------------------------------------------------- - - public function setDocument(document:Object, id:String = null):void - { - this.document = document; - } - - public function addChild(child:IEffect):void - { - if (!children) - children = [ child ]; - else - children.push(child); - } - - /** - * @private - */ - override public function play():void - { - dispatchEvent(new Event(Effect.EFFECT_START)); - current = 0; - var n:int = children.length; - for (var i:int = 0; i < n; i++) - playChildEffect(i); - } - - private var current:int; - - private function playChildEffect(index:int):void - { - var child:IEffect = children[index]; - child.addEventListener(Effect.EFFECT_END, effectEndHandler); - child.play(); - } - - private function effectEndHandler(event:Event):void - { - current++; - if (current >= children.length) - dispatchEvent(new Event(Effect.EFFECT_END)); - } -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/PlatformWiper.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/PlatformWiper.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/PlatformWiper.as deleted file mode 100644 index 1e3b412..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/PlatformWiper.as +++ /dev/null @@ -1,138 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -COMPILE::AS3 -{ - import flash.display.DisplayObject; - import flash.geom.Rectangle; -} -COMPILE::JS -{ - import org.apache.flex.geom.Rectangle; -} - -import org.apache.flex.core.IDocument; -import org.apache.flex.core.IUIBase; - -/** - * Helper class for Wipe effects. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public class PlatformWiper -{ - - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function PlatformWiper() - { - super(); - } - - //-------------------------------------------------------------------------- - // - // Variables - // - //-------------------------------------------------------------------------- - - /** - * @private - * The target. - */ - private var _target:IUIBase; - - /** - * @private - * The old overflow value. - */ - private var _overflow:String; - - /** - * The object that will be clipped. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function set target(value:IUIBase):void - { - COMPILE::AS3 - { - if (value == null) - DisplayObject(_target).scrollRect = null; - _target = value; - } - COMPILE::JS - { - if (value == null) - { - if (_overflow == null) - delete _target.positioner.style["overflow"]; - else - _target.positioner.style.overflow = _overflow; - } - _target = value; - if (value != null) { - _overflow = _target.positioner.style.overflow; - } - } - } - - /** - * The visible rectangle. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function set visibleRect(value:Rectangle):void - { - COMPILE::AS3 - { - DisplayObject(_target).scrollRect = value; - } - COMPILE::JS - { - _target.positioner.style.height = value.height.toString() + 'px'; - _target.positioner.style.overflow = 'hidden'; - } - } -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/Resize.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Resize.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/Resize.as deleted file mode 100644 index 2ee1e15..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Resize.as +++ /dev/null @@ -1,197 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -import org.apache.flex.core.IDocument; -import org.apache.flex.core.IUIBase; - -/** - * The Resize effect animates a UI component's width or height. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public class Resize extends Tween implements IDocument -{ - - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * Constructor. - * - * @param target Object ID or reference to an object that will - * have its x and/or y property animated. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function Resize(target:IUIBase = null) - { - super(); - - this.actualTarget = target; - startValue = 0; - endValue = 1; - - listener = this; - } - - //-------------------------------------------------------------------------- - // - // Variables - // - //-------------------------------------------------------------------------- - - /** - * @private - * The document. - */ - private var document:Object; - - /** - * @private - * The target. - */ - private var actualTarget:IUIBase; - - /** - * The target as the String id - * of a widget in an MXML Document. - */ - public var target:String; - - /** - * The change in width. - */ - public var widthBy:Number; - - /** - * The change in height. - */ - public var heightBy:Number; - - /** - * @private - * The starting width. - */ - private var widthStart:Number; - - /** - * @private - * The starting height. - */ - private var heightStart:Number; - - /** - * Starting width value. If NaN, the current width value is used - */ - public var widthFrom:Number; - - /** - * Starting height value. If NaN, the current height value is used - */ - public var heightFrom:Number; - - /** - * Ending width value. - */ - public var widthTo:Number; - - /** - * Ending height value. - */ - public var heightTo:Number; - - - //-------------------------------------------------------------------------- - // - // Properties - // - //-------------------------------------------------------------------------- - - - //-------------------------------------------------------------------------- - // - // Methods - // - //-------------------------------------------------------------------------- - - public function setDocument(document:Object, id:String = null):void - { - this.document = document; - } - - /** - * @private - */ - override public function play():void - { - if (target != null) - actualTarget = document[target]; - - if (isNaN(widthFrom)) - widthStart = actualTarget.width; - if (isNaN(widthBy)) - { - if (isNaN(widthTo)) - widthBy = 0; - else - widthBy = widthTo - widthStart; - } - - if (isNaN(heightFrom)) - heightStart = actualTarget.height; - if (isNaN(heightBy)) - { - if (isNaN(heightTo)) - heightBy = 0; - else - heightBy = heightTo - heightStart; - } - super.play(); - } - - public function onTweenUpdate(value:Number):void - { - if (widthBy) - actualTarget.width = widthStart + value * widthBy; - if (heightBy) - actualTarget.height = heightStart + value * heightBy; - } - - public function onTweenEnd(value:Number):void - { - if (widthBy) - actualTarget.width = widthStart + widthBy; - if (heightBy) - actualTarget.height = heightStart + heightBy; - } -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/Sequence.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Sequence.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/Sequence.as deleted file mode 100644 index f6c3343..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Sequence.as +++ /dev/null @@ -1,152 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -import org.apache.flex.core.IDocument; -import org.apache.flex.core.IUIBase; -import org.apache.flex.events.Event; - -[DefaultProperty("children")] - -/** - * The Sequence effect animates a set of effects one - * at a time. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public class Sequence extends Effect implements IDocument -{ - - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function Sequence() - { - super(); - } - - //-------------------------------------------------------------------------- - // - // Variables - // - //-------------------------------------------------------------------------- - - /** - * @private - * The document. - */ - private var document:Object; - - /** - * @private - * The target. - */ - private var target:IUIBase; - - /** - * The children. - */ - public var children:Array; - - - - //-------------------------------------------------------------------------- - // - // Properties - // - //-------------------------------------------------------------------------- - - /** - * @private - */ - override public function set duration(value:Number):void - { - var n:int = children.length; - for (var i:int = 0; i < 0; i++) - { - children[i].duration = value; - } - super.duration = value; - } - - //-------------------------------------------------------------------------- - // - // Methods - // - //-------------------------------------------------------------------------- - - public function setDocument(document:Object, id:String = null):void - { - this.document = document; - } - - public function addChild(child:IEffect):void - { - if (!children) - children = [ child ]; - else - children.push(child); - } - - /** - * @private - */ - override public function play():void - { - dispatchEvent(new Event(Effect.EFFECT_START)); - current = 0; - playChildEffect(); - } - - private var current:int; - - private function playChildEffect():void - { - var child:IEffect = children[current]; - child.addEventListener(Effect.EFFECT_END, effectEndHandler); - child.play(); - } - - private function effectEndHandler(event:Event):void - { - current++; - if (current >= children.length) - dispatchEvent(new Event(Effect.EFFECT_END)); - else - playChildEffect(); - } -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/Tween.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Tween.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/Tween.as deleted file mode 100644 index 3b9415e..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Tween.as +++ /dev/null @@ -1,665 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -import org.apache.flex.core.IEffectTimer; -import org.apache.flex.core.ValuesManager; -import org.apache.flex.events.ValueEvent; -import org.apache.flex.events.Event; -import org.apache.flex.events.EventDispatcher; - -/** - * Tween is the underlying animation class for the effects in FlexJS. - * - * The Tween class defines a tween, a property animation performed - * on a target object over a period of time. - * That animation can be a change in position, such as performed by - * the Move effect; a change in size, as performed by the Resize or - * Zoom effects; a change in visibility, as performed by the Fade or - * Dissolve effects; or other types of animations. - * - * <p>A Tween instance accepts the <code>startValue</code>, - * <code>endValue</code>, and <code>duration</code> properties, - * and an optional easing function to define the animation.</p> - * - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public class Tween extends Effect -{ - //-------------------------------------------------------------------------- - // - // Class constants - // - //-------------------------------------------------------------------------- - - /** - * The <code>Tween.TWEEN_END</code> constant defines the value of the - * event object's <code>type</code> property for a <code>tweenEnd</code> event. - * - * <p>The properties of the event object have the following values:</p> - * <table class="innertable"> - * <tr><th>Property</th><th>Value</th></tr> - * <tr><td><code>bubbles</code></td><td>false</td></tr> - * <tr><td><code>cancelable</code></td><td>false</td></tr> - * <tr><td><code>currentTarget</code></td><td>The Object that defines the - * event listener that handles the event. For example, if you use - * <code>myButton.addEventListener()</code> to register an event listener, - * myButton is the value of the <code>currentTarget</code>. </td></tr> - * <tr><td><code>target</code></td><td>The Object that dispatched the event; - * it is not always the Object listening for the event. - * Use the <code>currentTarget</code> property to always access the - * Object listening for the event.</td></tr> - * <tr><td><code>value</code></td><td>The value passed to the - * <code>onTweenEnd()</code> method.</td></tr> - * </table> - * - * @see org.apache.flex.effects.Effect - * @see org.apache.flex.effects.TweenEffect - * @see org.apache.flex.events.EffectEvent - * @eventType tweenEnd - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public static const TWEEN_END:String = "tweenEnd"; - - /** - * The <code>Tween.TWEEN_START</code> constant defines the value of the - * event object's <code>type</code> property for a <code>tweenStart</code> event. - * - * <p>The properties of the event object have the following values:</p> - * <table class="innertable"> - * <tr><th>Property</th><th>Value</th></tr> - * <tr><td><code>bubbles</code></td><td>false</td></tr> - * <tr><td><code>cancelable</code></td><td>false</td></tr> - * <tr><td><code>currentTarget</code></td><td>The Object that defines the - * event listener that handles the event. For example, if you use - * <code>myButton.addEventListener()</code> to register an event listener, - * myButton is the value of the <code>currentTarget</code>. </td></tr> - * <tr><td><code>target</code></td><td>The Object that dispatched the event; - * it is not always the Object listening for the event. - * Use the <code>currentTarget</code> property to always access the - * Object listening for the event.</td></tr> - * <tr><td><code>value</code></td><td>The value passed to the - * <code>onTweenUpdate()</code> method.</td></tr> - * </table> - * - * @eventType tweenStart - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public static const TWEEN_START:String = "tweenStart"; - - /** - * The <code>Tween.TWEEN_UPDATE</code> constant defines the value of the - * event object's <code>type</code> property for a <code>tweenUpdate</code> event. - * - * <p>The properties of the event object have the following values:</p> - * <table class="innertable"> - * <tr><th>Property</th><th>Value</th></tr> - * <tr><td><code>bubbles</code></td><td>false</td></tr> - * <tr><td><code>cancelable</code></td><td>false</td></tr> - * <tr><td><code>currentTarget</code></td><td>The Object that defines the - * event listener that handles the event. For example, if you use - * <code>myButton.addEventListener()</code> to register an event listener, - * myButton is the value of the <code>currentTarget</code>. </td></tr> - * <tr><td><code>target</code></td><td>The Object that dispatched the event; - * it is not always the Object listening for the event. - * Use the <code>currentTarget</code> property to always access the - * Object listening for the event.</td></tr> - * <tr><td><code>value</code></td><td>The value passed to the - * <code>onTweenUpdate()</code> method.</td></tr> - * </table> - * - * @eventType tweenUpdate - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public static const TWEEN_UPDATE:String = "tweenUpdate"; - - - //-------------------------------------------------------------------------- - // - // Class variables - // - //-------------------------------------------------------------------------- - - /** - * The list of tweens that are currently playing. - */ - public static var activeTweens:Object = {}; - - private static var timer:IEffectTimer; - - private static var currentID:int = 1; - - //-------------------------------------------------------------------------- - // - // Class properties - // - //-------------------------------------------------------------------------- - - //---------------------------------- - // currentTime - //---------------------------------- - - /** - * Used by effects to get the current effect time tick. - */ - public static var currentTime:Number = NaN; - - //-------------------------------------------------------------------------- - // - // Class methods - // - //-------------------------------------------------------------------------- - - /** - * @private - */ - private static function addTween(tween:Tween):void - { - tween.id = currentID++; - - activeTweens[tween.id] = tween; - - if (!timer) - { - timer = ValuesManager.valuesImpl.newInstance(tween, "iEffectTimer") as IEffectTimer; - timer.addEventListener("update", updateHandler); - } - currentTime = timer.start(); - - tween.startTime = tween.previousUpdateTime = currentTime; - } - - - /** - * @private - */ - private static function removeTween(tween:Tween):void - { - delete activeTweens[tween.id]; - if (activeTweens.length == 0) - timer.stop(); - } - - /** - * @private - */ - private static function updateHandler(event:ValueEvent):void - { - var oldTime:Number = currentTime; - - // the IEFfectTimer can control the current time - // if it wants. This can be useful for automated - // testing. - currentTime = event.value as Number; - - for (var id:String in activeTweens) - { - var tween:Tween = Tween(activeTweens[id]); - tween.update(); - } - } - - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * Constructor. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function Tween() - { - } - - //-------------------------------------------------------------------------- - // - // Variables - // - //-------------------------------------------------------------------------- - - /** - * @private - */ - private var id:int = -1; - - /** - * @private - */ - private var _doSeek:Boolean = false; - - /** - * @private - */ - private var _isPlaying:Boolean = true; - - /** - * @private - */ - private var _doReverse:Boolean = false; - - /** - * @private - */ - private var startTime:Number; - - /** - * @private - */ - private var previousUpdateTime:Number; - - /** - * @private - */ - private var userEquation:Function; - - /** - * Final value of the animation. - */ - public var endValue:Number; - - /** - * Initial value of the animation. - */ - public var startValue:Number; - - /** - * @private - */ - private var started:Boolean = false; - - //-------------------------------------------------------------------------- - // - // Properties - // - //-------------------------------------------------------------------------- - - //---------------------------------- - // listener - //---------------------------------- - - /** - * Object that is notified at each interval of the animation. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public var listener:Object; - - //---------------------------------- - // playheadTime - //---------------------------------- - - /** - * @private - * Storage for the playheadTime property. - */ - private var _playheadTime:Number = 0; - - /** - * @private - * The current millisecond position in the tween. - * This value is between 0 and duration. - * Use the seek() method to change the position of the tween. - */ - private function get playheadTime():Number - { - return _playheadTime; - } - - //---------------------------------- - // playReversed - //---------------------------------- - - /** - * @private - * Storage for the playReversed property. - */ - private var _invertValues:Boolean = false; - - /** - * @private - * Starts playing reversed from start of tween. - * Setting this property to <code>true</code> - * inverts the values returned by the tween. - * Using reverse inverts the values and only plays - * for as much time that has already elapsed. - */ - private function get playReversed():Boolean - { - return _invertValues; - } - - /** - * @private - */ - private function set playReversed(value:Boolean):void - { - _invertValues = value; - } - - //-------------------------------------------------------------------------- - // - // Methods - // - //-------------------------------------------------------------------------- - - - /** - * Sets the easing function for the animation. - * The easing function is used to interpolate between - * the <code>startValue</code> value and the <code>endValue</code>. - * A trivial easing function does linear interpolation, - * but more sophisticated easing functions create the illusion of - * acceleration and deceleration, which makes the animation seem - * more natural. - * - * <p>If no easing function is specified, an easing function based - * on the <code>Math.sin()</code> method is used.</p> - * - * <p>The easing function follows the function signature - * popularized by Robert Penner. - * The function accepts four arguments. - * The first argument is the "current time", - * where the animation start time is 0. - * The second argument is a the initial value - * at the beginning of the animation (a Number). - * The third argument is the ending value - * minus the initial value. - * The fourth argument is the duration of the animation. - * The return value is the interpolated value for the current time - * (usually a value between the initial value and the ending value).</p> - * - * <p>Flex includes a set of easing functions - * in the mx.effects.easing package.</p> - * - * @param easingFunction Function that implements the easing equation. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function set easingFunction(value:Function):void - { - userEquation = value; - } - - /** - * Interrupt the tween, jump immediately to the end of the tween, - * and invoke the <code>onTweenEnd()</code> callback function. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function endTween():void - { - var event:ValueEvent = new ValueEvent(Tween.TWEEN_END); - var value:Object = getCurrentValue(duration); - - event.value = value; - - dispatchEvent(event); - - listener.onTweenEnd(value); - - dispatchEvent(new Event(Effect.EFFECT_END)); - - // If tween has been added, id >= 0 - // but if duration = 0, this might not be the case. - if (id >= 0) { - Tween.removeTween(this); - id = -1; - } - } - - /** - * @private - * Returns true if the tween has ended. - */ - protected function update():Boolean - { - var tweenEnded:Boolean = false; - - // If user specified a minimum frames per second, we can't guarantee - // that we'll be called often enough to satisfy that request. - // However, we can avoid skipping over part of the animation. - // If this callback arrives too late, adjust the animation startTime, - // so that the animation starts up 'maxDelay' milliseconds - // after its last update. - /* - if (intervalTime - previousUpdateTime > maxDelay) - { - startTime += intervalTime - previousUpdateTime - maxDelay; - } - */ - previousUpdateTime = currentTime; - - if (_isPlaying || _doSeek) - { - - var elapsedTime:Number = currentTime - startTime; - _playheadTime = elapsedTime; - - var currentValue:Object = - getCurrentValue(elapsedTime); - - if (elapsedTime >= duration && !_doSeek) - { - endTween(); - tweenEnded = true; - } - else - { - if (!started) - { - var startEvent:ValueEvent = new ValueEvent(Tween.TWEEN_START); - dispatchEvent(startEvent); - started = true; - } - - var event:ValueEvent = - new ValueEvent(Tween.TWEEN_UPDATE); - event.value = currentValue; - - dispatchEvent(event); - - listener.onTweenUpdate(currentValue); - } - - _doSeek = false; - } - return tweenEnded; - } - - /** - * @private - */ - protected function getCurrentValue(currentTime:Number):Object - { - if (duration == 0) - { - return endValue; - } - - if (_invertValues) - currentTime = duration - currentTime; - - return userEquation(currentTime, startValue, - endValue - startValue, - duration); - } - - /** - * @private - */ - private function defaultEasingFunction(t:Number, b:Number, - c:Number, d:Number):Number - { - return c / 2 * (Math.sin(Math.PI * (t / d - 0.5)) + 1) + b; - } - - /** - * Advances the tween effect to the specified position. - * - * @param playheadTime The position, in milliseconds, between 0 - * and the value of the <code>duration</code> property. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function seek(playheadTime:Number):void - { - // Set value between 0 and duration - //playheadTime = Math.min(Math.max(playheadTime, 0), duration); - - var clockTime:Number = currentTime; - - // Reset the previous update time - previousUpdateTime = clockTime; - - // Reset the start time - startTime = clockTime - playheadTime; - - _doSeek = true; - - update(); - } - - /** - * Plays the effect in reverse, - * starting from the current position of the effect. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - override public function reverse():void - { - if (_isPlaying) - { - _doReverse = false; - seek(duration - _playheadTime); - _invertValues = !_invertValues; - } - else - { - _doReverse = !_doReverse; - } - } - - /** - * Pauses the effect until you call the <code>resume()</code> method. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - override public function pause():void - { - _isPlaying = false; - } - - /** - * Stops the tween, ending it without dispatching an event or calling - * the Tween's endFunction or <code>onTweenEnd()</code>. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - override public function play():void - { - if (userEquation == null) - userEquation = defaultEasingFunction; - Tween.addTween(this); - } - - /** - * Stops the tween, ending it without dispatching an event or calling - * the Tween's endFunction or <code>onTweenEnd()</code>. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - override public function stop():void - { - if (id >= 0) { - Tween.removeTween(this); - id = -1; - } - } - - /** - * Resumes the effect after it has been paused - * by a call to the <code>pause()</code> method. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - override public function resume():void - { - _isPlaying = true; - - startTime = currentTime - _playheadTime; - if (_doReverse) - { - reverse(); - _doReverse = false; - } - } -} - -} http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c99bd398/frameworks/projects/Effects/as/src/org/apache/flex/effects/Wipe.as ---------------------------------------------------------------------- diff --git a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Wipe.as b/frameworks/projects/Effects/as/src/org/apache/flex/effects/Wipe.as deleted file mode 100644 index fe83935..0000000 --- a/frameworks/projects/Effects/as/src/org/apache/flex/effects/Wipe.as +++ /dev/null @@ -1,156 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Licensed to the Apache Software Foundation (ASF) under one or more -// contributor license agreements. See the NOTICE file distributed with -// this work for additional information regarding copyright ownership. -// The ASF licenses this file to You under the Apache License, Version 2.0 -// (the "License"); you may not use this file except in compliance with -// the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -//////////////////////////////////////////////////////////////////////////////// - -package org.apache.flex.effects -{ - -import org.apache.flex.core.IDocument; -import org.apache.flex.core.IUIBase; -import org.apache.flex.geom.Rectangle; - -/** - * The Fade effect animates a UI component's alpha or opacity. - * - * @langversion 3.0 - * @playerversion Flash 10.2 - * @playerversion AIR 2.6 - * @productversion FlexJS 0.0 - */ -public class Wipe extends Tween implements IDocument -{ - - //-------------------------------------------------------------------------- - // - // Constructor - // - //-------------------------------------------------------------------------- - - /** - * Constructor. - * - * @param target Object ID or reference to an object that will - * have its x and/or y property animated. - * - * @langversion 3.0 - * @playerversion Flash 9 - * @playerversion AIR 1.1 - * @productversion Flex 3 - */ - public function Wipe(target:IUIBase = null) - { - super(); - - this.actualTarget = target; - - listener = this; - } - - //-------------------------------------------------------------------------- - // - // Variables - // - //-------------------------------------------------------------------------- - - /** - * @private - * The document. - */ - private var document:Object; - - /** - * @private - * The target. - */ - private var actualTarget:IUIBase; - - /** - * The target as the String id - * of a widget in an MXML Document. - */ - public var target:String; - - /** - * The direction of the Wipe. "up" means the top will be the last - * part to disappear. "down" will reveal from the top down. - */ - public var direction:String; - - private var wiper:PlatformWiper = new PlatformWiper(); - - //-------------------------------------------------------------------------- - // - // Properties - // - //-------------------------------------------------------------------------- - - - //-------------------------------------------------------------------------- - // - // Methods - // - //-------------------------------------------------------------------------- - - public function setDocument(document:Object, id:String = null):void - { - this.document = document; - } - - /** - * @private - */ - override public function play():void - { - if (target != null) - actualTarget = document[target]; - - - wiper.target = actualTarget; - if (direction == "up") - { - startValue = actualTarget.height; - endValue = 0; - } - else - { - startValue = 0; - endValue = actualTarget.height; - // WipeDown makes something appear - actualTarget.visible = true; - wiper.visibleRect = new Rectangle(0, 0, actualTarget.width, 0); - } - - super.play(); - } - - public function onTweenUpdate(value:Number):void - { - trace(actualTarget, value); - wiper.visibleRect = new Rectangle(0, 0, actualTarget.width, value); - } - - public function onTweenEnd(value:Number):void - { - // WipeUp makes something disappear - if (direction == "up") - actualTarget.visible = false; - wiper.target = null; - } -} - -}
