zoukankan      html  css  js  c++  java
  • flex 3d旋转

    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
    					   xmlns:s="library://ns.adobe.com/flex/spark" 
    					   xmlns:mx="library://ns.adobe.com/flex/mx" width="800" height="500" 
    					   creationComplete="windowedapplication1_creationCompleteHandler(event)">
    	<fx:Script>
    		<![CDATA[
    			import com.greensock.TweenLite;
    			import com.greensock.easing.*;
    			
    			import mx.events.FlexEvent;
    			// variable declarations ------------------------------------
    			private var timer:Number = 0;
    			
    			private var radius:Number = 300;
    			private var _cosAngle:Number;
    			private var _sinAngle:Number;
    			// getter/setters -------------------------------------------
    			// helper methods -------------------------------------------
    			// event handlers -------------------------------------------			
    			protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
    			{
    				addEventListener(Event.ENTER_FRAME,onFrame);
    			}
    			
    			
    			protected function onFrame(event:Event):void
    			{
    				_cosAngle = Math.cos(timer/100);
    				_sinAngle = Math.sin(timer/100);
    				if(timer % 1 == 0){
    					
    					var xPos:Number = radius * _cosAngle - radius * _sinAngle;
    					var zPos:Number = radius * _cosAngle + radius * _sinAngle;
    					img.x = xPos + 500;
    					img.z = zPos + 400;
    					img.rotationY = -timer*100/180+30;
    					//TweenLite.to(img,1,{x:(xPos+400),z:(zPos+400)});
    				}
    				timer++;
    				//trace(posX);
    			}
    			
    		]]>
    	</fx:Script>
    	
    	<fx:Declarations>
    		<!-- Place non-visual elements (e.g., services, value objects) here -->
    	</fx:Declarations>
    	<s:Image id="img" y="380" source="assets/cc.jpg"/>
    </s:WindowedApplication>
    
  • 相关阅读:
    ASP.Net MVC开发基础学习笔记:五、区域、模板页与WebAPI初步
    解决编写 xml 没有代码提示
    使用Windows Live Writer拉取之前写的博客
    C# 中的语法糖
    在 visual studio 中添加 ILDASM 工具
    EasyUI 学习笔记
    JQuery 学习笔记--02
    AngularJS 中特性(attr)和属性(prop)的区别
    AngularJS 学习笔记--01
    C# 中常用的索引器
  • 原文地址:https://www.cnblogs.com/houdinime/p/2946468.html
Copyright © 2011-2022 走看看