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