纳金网
标题:
Flash3D学习——Sandy学习笔记 [17]
[打印本页]
作者:
.
时间:
2012-8-27 11:20
标题:
Flash3D学习——Sandy学习笔记 [17]
Sandy支持缓动效果。
我个人比较喜欢 TweenLite 所以试试看,在 Sandy 中是否能支持TweenLite 的缓动效果。
成功了,哈哈,效果不错吧。
这里我就不过多介绍 TweenLite 了,有兴趣的话去他的官方网站下载可查阅文档就好了,使用方法很简单。 TweenLite 官方网站地址
代码:
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
oaderQueue;
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( ***e , 0.1)
);
var material:Material = new ColorMaterial( 0xD7D79D , 1 , materialAttr );
material.lightingEnable = ***e;
var app01:Appearance = new Appearance( material );
// 第二套着色(导入库中贴图)
var bitmap:BitmapData = new MyPalm(0 , 0);
var material02:Material = new BitmapMaterial( bitmap );
var app02:Appearance = new Appearance( material02 );
// 第三套着色(导入外部图片)
var material03:Material = new BitmapMaterial( queue.data["t3"].bitmapData );
var app03:Appearance = new Appearance( material03 );
// 第四套着色(导入外部MC)
var material04:MovieMaterial = new MovieMaterial( queue.data["t1"] , 40);
material04.lightingEnable = ***e;
var app04:Appearance = new Appearance( material04 );
// 第五套着色(导入库中MC)
var myMC:MovieClip = new _MC();
var material05:MovieMaterial = new MovieMaterial(myMC , 40);
material05.lightingEnable = ***e;
var app05:Appearance = new Appearance( material05 );
// 第六套着色(导入外部MC)
var material06:MovieMaterial = new MovieMaterial( queue.data["t2"] , 40);
material06.lightingEnable = false;
var app06:Appearance = new Appearance( material06 );
//应用着色
//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
作者:
她。
时间:
2012-11-2 09:27
作者:
.
时间:
2012-11-8 21:27
这是一个好帖子,大家快来围观!!
作者:
89684598
时间:
2014-2-22 15:52
谢谢分享
作者:
kikkik7000
时间:
2014-2-28 10:06
感谢分享
欢迎光临 纳金网 (http://old.narkii.com/club/)
Powered by Discuz! X2.5