그릴이 같은 그라데이션 라인에 애니메이션을 적용 할 수 있습니다 :
이
package
{
import flash.display.GradientType;
import flash.display.InterpolationMethod;
import flash.display.SpreadMethod;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Matrix;
public class GradientLine extends Sprite
{
private var position:Number = 0;
public function GradientLine()
{
addEventListener(Event.ENTER_FRAME, drawLine);
}
private function drawLine(e:Event):void
{
graphics.clear();
var m:Matrix = new Matrix();
m.createGradientBox(stage.stageWidth, stage.stageHeight, 0, position, 0);
position -= 10;//move from right to left by 10px
graphics.lineStyle(2);
graphics.lineGradientStyle(GradientType.LINEAR, [ 0xFF0000, 0xFFCC00, 0x0000CC ], [ 1, 1, 1 ], [ 0, 128, 255 ], m, SpreadMethod.REFLECT, InterpolationMethod.RGB, position);
graphics.moveTo(0, 250);
graphics.lineTo(stage.stageWidth, 250);
}
}
}
무대가 사용할 수 있어야합니다. createGradientBox (너비, 높이)를 필요한 크기로 설정할 수 있습니다. SpreadMethod.REFLECT를 사용하면 그래디언트가 반영되므로 SpreadMethod.REPEAT를 사용해 볼 수 있습니다.
+1이 작품은 고맙습니다. 불행히도, erkmene가 지적한대로, 그것은 정말로 비싸다. 선이 움직이는 동안 마우스를 무대로 움직이면 약간의 지연이 생겼습니다. – TheDarkIn1978