这是我使用 AS3 所做的:
var BGround1:Background=new Background();
var BGround2:Background= Background();
stage.addChild(BGround1);
stage.addChild(BGround2);
addEventListener(Event.ENTER_FRAME, moveScroll, false, 0, true);
function moveScroll(e:Event): void
{
BGround1.x -= scrollSpeed;
BGround2.x -= scrollSpeed;
if(BGround1.x <= -BGround1.width)
{
BGround1.x =BGround2.x + BGround2.width;
}
else if(BGround2.x <= -BGround2.width)
{
BGround2.x = BGround1.x + BGround1.width;
}
}
但是,如果我设置scrollSpeed
得太高,则运动不流畅。有什么方法可以制作流畅的动画吗?提前致谢。