actionscript 3 - Patterns of simple as3 animations -


i want add functionality photo gallery - different types of animation of thumbs of photos. did code below. works fine, desired thumbs bounced off edges of stage.

and importantly, need different patterns of animation - movement 3d carousel, spinning in circle, movement of sun's rays , back, etc.

i grateful if have ready-made pieces of code these , similar animations.

[bindable] private var stagew:int = capabilities.screenresolutionx; [bindable] private var stageh:int = capabilities.screenresolutiony;  private var itemsvector:vector.<image>=new vector.<image>(); private var xspeedvector:vector.<number>=new vector.<number>(); private var yspeedvector:vector.<number>=new vector.<number>();  stage.addeventlistener(event.enter_frame, update);  private function movesetup():void { for(var i:int = 0; < flexglobals.toplevelapplication.objects.length; i++){     if (flexglobals.toplevelapplication.objects[i] image){         var item:image=flexglobals.toplevelapplication.objects[i] image;         item.x=math.random()*stagew;         item.y=math.random()*stageh;         var randomdirection:number=math.random()*2*math.pi;         this.addelement(item);         itemsvector.push(item);         xspeedvector.push(2*math.cos(randomdirection));         yspeedvector.push(2*math.sin(randomdirection));     } }    }  protected function update(event:event):void {     for(var i:uint=0;i<itemsvector.length;i++){         itemsvector[i].x+=xspeedvector[i];         itemsvector[i].y+=yspeedvector[i];         if(itemsvector[i].x>stagew){             itemsvector[i].x-=stagew;         }         if(itemsvector[i].x<0){             itemsvector[i].x+=stagew;         }         if(itemsvector[i].y>stageh){             itemsvector[i].y-=stageh;         }         if(itemsvector[i].y<0){             itemsvector[i].y+=stageh;         }     } } 

have @ greensock's tweenlite library pretty standard animation in flash (and, added bonus, has been ported javascript).

it supports various set easing functions including bounce function. paid version of library includes ability create custom easing functions. there's interactive demo half-way down first page link allows play around library live , test various easing functions.

a google search turn various tutorials explaining how build (pseudo) 3d orbiting carousels, third-party components same. in fact, these relatively simple implement hinging, do, on simple bit of trigonometry. this example seems make reasonable starting point adapt suit particular requirements.

3d effects can implemented in flex. suggest have @ away3d open-source 3d library written flash platform. there's example of horizontal spiral effect implemented in away3d (along complete source code) available here.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -