在闪光画廊效果AS3三维旋转螺旋
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在闪光画廊效果AS3三维旋转螺旋相关的知识,希望对你有一定的参考价值。
More information, Demo & FLA file download at http://www.adamcoulombe.info/lab/as3/spiral-gallery.html
import com.greensock.*; import com.greensock.easing.*; var galItems = new Array(); for(var i=0; i<40; i++){ var rad = (i * 12) + 60 ; galItems[i]=new Box(); galItems[i].x = Math.sin(rad) * rad; galItems[i].y = Math.cos(rad) * rad; galItems[i].z = (i - 20) * 40; galItems[i].rotationY = 90; trace(rad); ///////// This was tricky! Thanks to http://www.foundation-flash.com/tutorials/as3rotation/ galItems[i].selfRotX = (rad /(Math.PI /180)) + 90 ; ///////// galItems[i].rotationX = galItems[i].selfRotX ; gallery.helix.addChild(galItems[i]); gallery.z = 800; } addEventListener(Event.ENTER_FRAME,loop); function loop(e){ var distx:Number = mouseX / 650; var disty:Number = mouseY / 450; TweenLite.to(gallery, 2, { rotationY: 90 + ((-70 + (140*distx))*0.6), rotationX:(70 - (140*disty))*0.6, ease:Expo.easeOut }); TweenLite.to(gallery.helix, 2, {rotation: (mouseX - (stage.stageWidth/2)) * 1.6}); /* for (var i =0; i< galItems.length; i++){ TweenLite.to(galItems[i], 2, {rotationX: (galItems[i].selfRotX + mouseX - (stage.stageWidth/2 )) -90 }); } */ }
以上是关于在闪光画廊效果AS3三维旋转螺旋的主要内容,如果未能解决你的问题,请参考以下文章
使用AS3和Tweenlite实现简单的3D 360旋转悬停效果
ActionScript 3 在闪光AS3中轨道Polkadots(交互式)