flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cd...@apache.org
Subject [1/5] git commit: [flex-asjs] [refs/heads/feature/maven-migration] - Added Move effect to CreateJS framework and example.
Date Wed, 27 Apr 2016 07:42:22 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/feature/maven-migration 087dd8248 -> 9dbcb5d14


Added Move effect to CreateJS framework and example.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/8cb2031a
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/8cb2031a
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/8cb2031a

Branch: refs/heads/feature/maven-migration
Commit: 8cb2031ac069c57715dd48e0409038a497d87d11
Parents: 9a52f49
Author: Peter Ent <pent@apache.org>
Authored: Mon Apr 25 15:27:12 2016 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Mon Apr 25 15:27:12 2016 -0400

----------------------------------------------------------------------
 .../CreateJSExample/src/CreateJSExample.mxml    |  16 +-
 .../CreateJS/src/main/flex/CreateJSClasses.as   |   1 +
 .../org/apache/flex/createjs/Application.as     |   3 +
 .../apache/flex/createjs/core/CreateJSBase.as   |   5 +
 .../flex/org/apache/flex/createjs/tween/Move.as | 149 +++++++++++++++++++
 .../src/main/resources/createjs-manifest.xml    |   1 +
 6 files changed, 174 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8cb2031a/examples/flexjs/CreateJSExample/src/CreateJSExample.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/CreateJSExample/src/CreateJSExample.mxml b/examples/flexjs/CreateJSExample/src/CreateJSExample.mxml
index f7c8768..a2a678c 100644
--- a/examples/flexjs/CreateJSExample/src/CreateJSExample.mxml
+++ b/examples/flexjs/CreateJSExample/src/CreateJSExample.mxml
@@ -21,16 +21,30 @@ limitations under the License.
                    xmlns:local="*"
                    xmlns:js="library://ns.apache.org/flexjs/basic" 
                    xmlns:cjs="library://ns.apache.org/flexjs/createjs"
+                   applicationComplete="runEffect()"
                    >
 
     <js:valuesImpl>
         <js:SimpleCSSValuesImpl />
     </js:valuesImpl>
     
+    <fx:Script>
+    	<![CDATA[
+    		import org.apache.flex.createjs.tween.Move;
+    		
+    		private function runEffect():void {
+    			var mover:Move = new Move(circle);
+    			mover.xTo = 400;
+    			mover.yTo = 400;
+    			mover.play();
+    		}
+    	]]>
+    </fx:Script>
+    
     <js:initialView>
         <cjs:View>
         
-			<cjs:Circle x="100" y="120" width="100" height="100">
+			<cjs:Circle id="circle" x="100" y="100" width="100" height="100">
 				<js:fill>
 					<js:SolidColor color="#26C9FF" />
 				</js:fill>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8cb2031a/frameworks/projects/CreateJS/src/main/flex/CreateJSClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/CreateJS/src/main/flex/CreateJSClasses.as b/frameworks/projects/CreateJS/src/main/flex/CreateJSClasses.as
index 816c665..a39aaee 100644
--- a/frameworks/projects/CreateJS/src/main/flex/CreateJSClasses.as
+++ b/frameworks/projects/CreateJS/src/main/flex/CreateJSClasses.as
@@ -30,6 +30,7 @@ internal class CreateJSClasses
 	import org.apache.flex.createjs.core.UIBase; UIBase;
 	import org.apache.flex.createjs.core.View; View;
 	import org.apache.flex.createjs.graphics.GraphicShape; GraphicShape;
+	import org.apache.flex.createjs.tween.Move; Move;
 }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8cb2031a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as
b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as
index 46ca931..3ef4196 100644
--- a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as
+++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/Application.as
@@ -123,6 +123,7 @@ package org.apache.flex.createjs
          *
          * <inject_html>
          * <script src="https://code.createjs.com/easeljs-0.8.1.min.js"></script>
+		 * <script src="https://code.createjs.com/tweenjs-0.6.2.min.js"></script>
          * </inject_html>
          */
 		public function Application()
@@ -167,6 +168,8 @@ package org.apache.flex.createjs
             dispatchEvent('viewChanged');
             
             stage.update();
+			
+			dispatchEvent('applicationComplete');
         }
 		
 		/**

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8cb2031a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/CreateJSBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/CreateJSBase.as
b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/CreateJSBase.as
index d23359e..3f13292 100644
--- a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/CreateJSBase.as
+++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/core/CreateJSBase.as
@@ -33,6 +33,11 @@ package org.apache.flex.createjs.core
 		import org.apache.flex.core.graphics.SolidColor;
     }
 	
+	COMPILE::AS3
+	{
+		import org.apache.flex.core.UIBase;
+	}
+	
 	/**
 	 * This is the base class for CreateJS component wrappers used by FlexJS
 	 * applications. This class provides standard properties that most of the

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8cb2031a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/tween/Move.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/tween/Move.as
b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/tween/Move.as
new file mode 100644
index 0000000..4644ab1
--- /dev/null
+++ b/frameworks/projects/CreateJS/src/main/flex/org/apache/flex/createjs/tween/Move.as
@@ -0,0 +1,149 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.createjs.tween
+{	
+	import org.apache.flex.events.EventDispatcher;
+	
+	import org.apache.flex.createjs.core.CreateJSBase;
+	
+	COMPILE::JS {
+		import createjs.Tween;
+		import createjs.Stage;
+		import createjs.Ease;
+		import createjs.Ticker;
+	}
+		
+    /**
+     * The Move effect animates an object from one place to another. Once the
+	 * target object is set, its starting position may be given (or its current
+	 * location will be used) and an ending position given, the play() function
+	 * is used to make the animation have effect. 
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+     */
+	public class Move extends EventDispatcher
+	{
+		/**
+		 * Constructor 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+        public function Move(target:Object=null)
+		{
+			super();
+			
+			actualTarget = target;
+		}
+		
+		
+		private var _actualTarget:Object;
+		
+		/**
+		 *  @private
+		 *  The actual target.
+		 */
+		public function get actualTarget():Object
+		{
+			return _actualTarget;
+		}
+		public function set actualTarget(value:Object):void
+		{
+			_actualTarget = value;
+		}
+		
+		
+		/**
+		 *  Starting x value.  If NaN, the current x value is used 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public var xFrom:Number;
+		
+		/**
+		 *  Ending x value.  If NaN, the current x value is not changed 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public var xTo:Number;
+		
+		/**
+		 *  Starting y value.  If NaN, the current y value is used 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public var yFrom:Number;
+		
+		/**
+		 *  Ending y value.  If NaN, the current y value is not changed 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 */
+		public var yTo:Number;
+		
+		COMPILE::JS
+		private var tween:createjs.Tween;
+		
+		/**
+		 *  Causes the target object to move between its starting and ending positions. 
+		 *  
+		 *  @langversion 3.0
+		 *  @playerversion Flash 9
+		 *  @playerversion AIR 1.1
+		 *  @productversion Flex 3
+		 *  @flexignorecoercion createjs.Shape
+		 *  @flexignorecoercion org.apache.flex.createjs.core.CreateJSBase
+		 */
+		public function play():void
+		{
+			COMPILE::JS {
+				var target:CreateJSBase = actualTarget as CreateJSBase;
+				var element:createjs.Shape = target.element as createjs.Shape;
+				tween = createjs.Tween.get(element, {loop: false});
+				
+				var options:Object = {x:xTo, y:yTo};
+				
+				if (!isNaN(xFrom)) target.x = xFrom;
+				if (!isNaN(yFrom)) target.y = yFrom;
+				
+				tween.to( options, 1000, createjs.Ease.getPowInOut(2));
+				
+				var stage:createjs.Stage = element.getStage();
+				createjs.Ticker.addEventListener("tick", stage);
+			}
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/8cb2031a/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml b/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml
index 5716695..ec1414f 100644
--- a/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml
+++ b/frameworks/projects/CreateJS/src/main/resources/createjs-manifest.xml
@@ -29,5 +29,6 @@
     <component id="Label" class="org.apache.flex.createjs.Label"/>
     <component id="Circle" class="org.apache.flex.createjs.graphics.Circle" />
     <component id="Rect" class="org.apache.flex.createjs.graphics.Rect" />
+    <component id="Move" class="org.apache.flex.createjs.tween.Move" />
 
 </componentPackage>


Mime
View raw message