Monday, December 16, 2013

animasi spiral

1. Bukalah Adobe Flash document, ukuran misalnya 500 x 500 px
2. Klik frame 1 kemudian tekan f9, pada panel actions ketikan script seperti berikut : 

jarak = 0;
sudut = 0;
posX = 0;
posY = 0;
kecepatan = 0.2;
this.createEmptyMovieClip("spiral", this.getNextHighestDepth());
spiral._x = Stage.width/2;
spiral._y = Stage.height/2;
spiral.lineStyle(8, 0xea1a06);
onEnterFrame = function () {
 spiral._rotation += 20;
 if (jarak<150) {
  jarak += 0.7;
  sudut += kecepatan;
  posX = Math.cos(sudut)*jarak;
  posY = Math.sin(sudut)*jarak;
  spiral.lineTo(posX, posY);
 }
};


3. Tekan Ctrl Enter untuk menjalankan Animasinya

No comments:

Post a Comment