|
| damo |
Post
#1
|
|
Advanced Member Group: Members Posts: 44 Joined: 20-June 06 Member No.: 26 |
Hi all,
I've make a usefull class to do an animate rotation of a Sprite3D Offset. See this previous post to understand how to calculate the correct offset : http://www.flashsandy.org/forum/index.php?showtopic=523 With my new class Sprite3DRotator, i can do an animate rotation like this : CODE Sprite3DRotator.getInstance().rotate(mySprite3D,angleDegree,10); So now, have a look to my (little) class : CODE /** * Utilitaire pour sprite * @author David Mouton * @version 1 */ import sandy.core.Sprite3D; import mx.transitions.Tween; import mx.transitions.easing.*; class com.expantion.utils.sprite.Sprite3DRotator { private var __sprite3D:Sprite3D; private static var __monInstance:Sprite3DRotator; private function Sprite3DRotator(){ } public function get spriteOffset():Number{ return __sprite3D.getOffset(); } public function set spriteOffset(val:Number):Void{ __sprite3D.setOffset(val); } /** * Effectue une rotation anime du Sprite3D * @param s * @param endOffset * @param time */ public function rotate(s:Sprite3D,endOffset:Number,time:Number, easeFunction:Function):Void{ __sprite3D = s; var debOffset:Number = s.getOffset(); if(easeFunction == undefined){ easeFunction = Regular.easeInOut; } var tw:Tween = new Tween(__monInstance,"spriteOffset",easeFunction,debOffset,endOffset,time,false); } /** * Acces aux methodes et aux propriétés du singleton * @return */ public static function getInstance():Sprite3DRotator{ if (__monInstance == undefined) { __monInstance = new Sprite3DRotator(); } return(__monInstance); } } have fun (IMG:style_emoticons/default/wink.gif) Attached File(s) |
| Petit |
Post
#2
|
|
Advanced Member Group: Moderator Posts: 587 Joined: 21-June 06 From: Borgholm, Sweden Member No.: 38 |
Hi all, I've make a usefull class to do an animate rotation of a Sprite3D Offset. See this previous post to understand how to calculate the correct offset. have fun (IMG:style_emoticons/default/wink.gif) Thanks damo for getting back with this nice piece of code. Much appreciated! (IMG:style_emoticons/default/rolleyes.gif) |
| damo |
Post
#3
|
|
Advanced Member Group: Members Posts: 44 Joined: 20-June 06 Member No.: 26 |
Hey petit,
It seems i'm in a good day. So i wrote this little tuto about Sprite3D and Orientation. It's in french and on my blog here : http://www.tamina-online.com/damo/index.ph...ibution-a-sandy (IMG:style_emoticons/default/biggrin.gif) |
| Lo-Fi Version | Time is now: 10th August 2007 - 03:06 AM |