Actionscript 3 AS3吐温缓和
我已经在flash中设置了一个悬停在某个元素上和悬停在某个元素上的选项,当你悬停在某个元素上时,一个信息窗口从底部滑入,当你悬停下来时,它会滑回。悬停,当我在悬停动画结束前悬停时,给定对象跳到第一个动画的末尾并返回。当有人悬停在某物上时,如何使动画轻松进出Actionscript 3 AS3吐温缓和,actionscript-3,tween,Actionscript 3,Tween,我已经在flash中设置了一个悬停在某个元素上和悬停在某个元素上的选项,当你悬停在某个元素上时,一个信息窗口从底部滑入,当你悬停下来时,它会滑回。悬停,当我在悬停动画结束前悬停时,给定对象跳到第一个动画的末尾并返回。当有人悬停在某物上时,如何使动画轻松进出 function initialPlacement() { block1.x = (-814); block1.y = (stage.stageHeight - 100); } initialPlacement(); te
function initialPlacement()
{
block1.x = (-814);
block1.y = (stage.stageHeight - 100);
}
initialPlacement();
tension.addEventListener(MouseEvent.ROLL_OVER,hover1);
tension.addEventListener(MouseEvent.ROLL_OUT,off1);
function hover1(event:MouseEvent):void{
hover1tween.start();
}
var hover1tween:Tween = new Tween(block1,"x",Regular.easeOut,(0-block1.width),0,30,false);
hover1tween.stop();
function off1(event:MouseEvent):void{
off1tween.start();
}
var off1tween:Tween = new Tween(block1,"x",Regular.easeInOut,0,(0-block1.width),30,false);
off1tween.stop();
initialPlacement();
我相信最简单的方法是使用“continueTo”功能,它将把tween发送到一个新的方向,而不是重新启动它
function initialPlacement()
{
block1.x = (-814);
block1.y = (stage.stageHeight - 100);
block1tween = new Tween(block1,"x",Regular.easeInOut,(0-block1.width),0,30,false);
block1tween.stop();
}
var block1tween:Tween;
initialPlacement();
tension.addEventListener(MouseEvent.ROLL_OVER,hover1);
tension.addEventListener(MouseEvent.ROLL_OUT,off1);
function hover1(event:MouseEvent):void{
block1tween.continueTo(0, 30);
}
function off1(event:MouseEvent):void{
block1tween.continueTo((0-block1.width),30);
}
这能满足你的需要吗?否则,您可以用一个新的来替换tween,每个都通过tween的“begin”参数中的当前坐标,但我发现只使用“continueTo()”更简单、更干净。感谢您的编辑,我不知道如何在这里格式化。这非常好!一般来说,我对actionscript非常陌生,所以我以前从未使用过该函数。谢谢