0
我有我在网上找到的代码,它可以无限旋转的图库,现在我的问题是在输入帧时它会跳转并且速度太快。我希望它能够在您将徽标悬停之后尽快完成。如何在不减少fps的情况下减慢AS3中的动画
下面是代码:
//Import TweenMax
import com.greensock.TweenMax;
//Save the horizontal center
var centerX:Number = stage.stageWidth/2;
//Save the width of the whole gallery
var galleryWidth:Number = infiniteGallery.width;
//Speed of the movement (calculated by the mouse position in the moveGallery() function)
var speed:Number = 0;
//Add an ENTER_FRAME listener for the animation
addEventListener(Event.ENTER_FRAME, moveGallery);
function moveGallery(e:Event):void {
//Calculate the new speed
speed = -(0.02 * (mouseX - centerX));
//Update the x coordinate
infiniteGallery.x+=speed;
//Check if we are too far on the right (no more stuff on the left edge)
if (infiniteGallery.x>0) {
//Update the gallery's coordinates
infiniteGallery.x= (-galleryWidth/2);
}
//Check if we are too far on the left (no more stuff on the right edge)
if (infiniteGallery.x<(-galleryWidth/2)) {
//Update the gallery's coordinates
infiniteGallery.x=0;
}
}
和这里是demo »
谢谢你,但我是新来的这一切动作事情会你介意复制粘贴整个代码的变化。请。 – 2010-01-20 16:58:12
我是新来的整个编程的事情。你会介意到我家来做我的工作/家庭作业/项目吗? Kthxbye – 2010-01-20 19:05:54
谢谢,但出现错误语法错误:“else”未指向 – 2010-01-21 14:45:15