使用变换工具缩放文本或影片剪辑时遇到问题。 我想做的只是创建补间动画,通过在开始时缩小影片剪辑,然后将其缩小到 100% 来制作缩放效果。
完成此操作并在末尾添加一些额外的帧后,影片剪辑从其原始位置移动,变形点从中心移动到其中一个角,从而导致形状偏移。
我想知道是否有人可以帮忙并告诉我如何解决这个问题......提前谢谢。
控件可能很糟糕,但代码应该仍然可以工作。 只需将补间应用于您的TextField
或MovieClip
即可。
单盒
import flash.display.Sprite;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.Event;
// A demonstration box
var box:Sprite = new Sprite();
box.graphics.beginFill(0xFF);
box.graphics.drawRect(-50, -50, 100, 100);
box.graphics.endFill();
addChild(box)
box.x = box.y = 100;
box.addEventListener("click", animateIn);
function animateIn(e:Event):void {
// Animate the X then the Y scale.
var anim:Tween = new Tween(box, "scaleX", Regular.easeOut, 1, 0.5, 1, true);
new Tween(box, "scaleY", Regular.easeOut, 1, 0.5, 1, true);
// Listen for the end of the animation, before running the second half.
anim.addEventListener("motionFinish", animateOut);
}
function animateOut(e:Event):void {
new Tween(box, "scaleX", Regular.easeOut, 0.5, 1, 1, true);
new Tween(box, "scaleY", Regular.easeOut, 0.5, 1, 1, true);
}
多个盒子
import flash.display.Sprite;
import fl.transitions.*;
import fl.transitions.easing.*;
import flash.events.Event;
var size:int = 40;
var columns:int = Math.floor(stage.stageWidth / size);
var rows:int = Math.floor(stage.stageHeight / size);
// Create demo boxes
var last:Sprite = null;
for (var c:int = 0; c < columns; c++) {
for (var r:int = 0; r < rows; r++) {
var box:Sprite = new Sprite();
box.graphics.beginFill(0xFF);
box.graphics.drawRect(-size/2 + 1, -size/2 + 1, size - 2, size - 2);
box.graphics.endFill();
addChild(box)
box.x = c*size + size/2;
box.y = r*size + size/2;
box.addEventListener("mouseOver", animateIn);
}
}
function animateIn(e:Event):void {
var box:Sprite = e.currentTarget as Sprite;
// Animate the X then the Y scale.
var anim:Tween = new Tween(box, "scaleX", Regular.easeOut, 1, 0.5, 0.35, true);
new Tween(box, "scaleY", Regular.easeOut, 1, 0.5, 0.35, true);
// Listen for the end of the animation, before running the second half.
anim.addEventListener("motionFinish", animateOut);
}
function animateOut(e:Event):void {
new Tween(e.currentTarget.obj, "scaleX", Regular.easeOut, 0.5, 1, 0.35, true);
new Tween(e.currentTarget.obj, "scaleY", Regular.easeOut, 0.5, 1, 0.35, true);
}