Sandy支持緩動效果。 我個人比較喜歡 TweenLite 所以試試看,在 Sandy 中是否能支持TweenLite 的緩動效果。
成功了,哈哈,效果不錯吧。 這里我就不過多介紹 TweenLite 了,有興趣的話去他的官方網(wǎng)站下載可查閱文檔就好了,使用方法很簡單。 TweenLite 官方網(wǎng)站地址
代碼:
package { import flash.display. * ; import flash.events. * ; import flash.ui. * ; import flash.net.URLRequest; import sandy.core.Scene3D; import sandy.core.data. * ; import sandy.core.scenegraph. * ; import sandy.materials. * ; import sandy.materials.attributes. * ; import sandy.primitive. * ; import sandy.util. * ; import sandy.events. * ; import com.greensock.*; import com.greensock.easing.*; /** * ... * @author ever5u */ public class fuxi extends Sprite { private var scene:Scene3D; private var camera:Camera3D; private var box:Box; private var queue:LoaderQueue; public function fuxi() { queue = new LoaderQueue(); queue.add( "t1" , new URLRequest("load/01.swf") ); queue.add( "t2" , new URLRequest("load/02.swf") ); queue.add( "t3" , new URLRequest("load/03.jpg") ); queue.addEventListener(SandyEvent.QUEUE_COMPLETE , loadComplete ); queue.start(); } private function loadComplete(_evt:Event):void { camera = new Camera3D( 300 , 300 ); camera.z = - 400; var root:Group = createScene(); scene = new Scene3D( "scene" , this , camera , root ); addEventListener( Event.ENTER_FRAME , enterFrameHandler ); stage.addEventListener(KeyboardEvent.KEY_DOWN , keyPressed); } private function createScene():Group { var g:Group = new Group(); box = new Box( "box" , 100 , 100 , 100 , "quad"); // 第一套著色(顏色) var materialAttr:MaterialAttributes = new MaterialAttributes( new LineAttributes( 0 , 0xD7D79D , 0 ) , new LightAttributes( true , 0.1) ); var material:Material = new ColorMaterial( 0xD7D79D , 1 , materialAttr ); material.lightingEnable = true; var app01:Appearance = new Appearance( material ); // 第二套著色(導(dǎo)入庫中貼圖) var bitmap:BitmapData = new MyPalm(0 , 0); var material02:Material = new BitmapMaterial( bitmap ); var app02:Appearance = new Appearance( material02 ); // 第三套著色(導(dǎo)入外部圖片) var material03:Material = new BitmapMaterial( queue.data["t3"].bitmapData ); var app03:Appearance = new Appearance( material03 ); // 第四套著色(導(dǎo)入外部MC) var material04:MovieMaterial = new MovieMaterial( queue.data["t1"] , 40); material04.lightingEnable = true; var app04:Appearance = new Appearance( material04 ); // 第五套著色(導(dǎo)入庫中MC) var myMC:MovieClip = new _MC(); var material05:MovieMaterial = new MovieMaterial(myMC , 40); material05.lightingEnable = true; var app05:Appearance = new Appearance( material05 ); // 第六套著色(導(dǎo)入外部MC) var material06:MovieMaterial = new MovieMaterial( queue.data["t2"] , 40); material06.lightingEnable = false; var app06:Appearance = new Appearance( material06 ); //應(yīng)用著色 //box.appearance = app01; box.aPolygons[0].appearance = app01; box.aPolygons[1].appearance = app02; box.aPolygons[2].appearance = app03; box.aPolygons[3].appearance = app04; box.aPolygons[4].appearance = app05; box.aPolygons[5].appearance = app06; g.addChild(box); return g; } private function enterFrameHandler( event : Event ) : void { box.rotateX = mouseX; box.rotateY = mouseY; scene.render(); } private function keyPressed(event:KeyboardEvent):void { switch(event.keyCode) { case Keyboard.PAGE_DOWN: camera.z -= 5; break; case Keyboard.PAGE_UP: camera.z += 5; break; case Keyboard.CONTROL: box.z = 0; box.x = 0; box.y = 120; TweenLite.to(box, 1, {y:20, ease:Bounce.easeOut}); break; } } } }
效果:Sandy_16.rar
經(jīng)典論壇交流: http://bbs.blueidea.com/thread-2958387-1-1.html
本文鏈接:http://www.95time.cn/tech/multimedia/2009/7221.asp
出處:藍色理想
責任編輯:bluehearts
上一頁 Flash3D學(xué)習(xí)——Sandy學(xué)習(xí)筆記 [16] 下一頁
◎進入論壇RIA設(shè)計與應(yīng)用版塊參加討論
|