Neler yeni

Yeni mesajlar Yeni konular En çok mesaj En çok tepki En çok görüntülenen

[As2] animasyon

hardnheavy

🌱Yeni Üye🌱
Katılım
31 Tem 2009
Mesajlar
3
Tepkime puanı
0
Arkadşlar söyle bi animasyon yaptım fakat devamını gtiremiyorum. Aşadığıda kodları yazan animasyonumu bir tuşa basınca başlatmak, başkabir tuşa basınca durdurmak, başka bir tuşa basınca "xson" ve "hiz" dğişkenlerini değiştirip yeniden başlatmak istiyorum. Fakat işin bu kısmında takıldım.
Ayrıca kodlar çok uzun oldu nasıl kısaltacağımı bilmiyorum:)
Actionscript'te ve programcılık da yeniyim.
Yardımlarınızı bekliyorum.

Kod:
//Su Balonu...
_root.createEmptyMovieClip("su", 10);
with (_root.su){
 _x = 0;
 _y = 0;
 pi = Math.PI;
 cos = Math.cos;
 sin = Math.sin;
 beginFill(0xBFBAD4);
 moveTo(205, 200);
 for(i = 0; i < pi*.64; i += .01){
  lineTo(200 + 5*cos(pi*i), 200 + 5*sin(pi*i));
 }
 endFill();
  beginFill(0xFFFFFF);
 moveTo(210, 200);
 for(i = 0; i < pi*.64; i += .01){
  lineTo(202 + 2*cos(pi*i), 198 + 2*sin(pi*i));
 }
 endFill();
}
 
//yuklmeler
import mx.transitions.Tween;
import mx.transitions.easing.*;
 
//
duplicateMovieClip("su",newname="su2",2);
duplicateMovieClip("su",newname="su3",3);
duplicateMovieClip("su",newname="su4",4);
duplicateMovieClip("su",newname="su5",5);
duplicateMovieClip("su",newname="su6",6);
duplicateMovieClip("su",newname="su7",7);
duplicateMovieClip("su",newname="su8",8);
 
// Degiskenler...
var xson=190;
var hiz=36;
 
// Efekt
function efekt(){
 var xScaleT:Tween = new Tween(su, "_y", Strong .easeOut, 60, 25, hiz, false);
 var xPosT:Tween = new Tween(su, "_x", Regular .easeOut, 90, xson, hiz, false);
 var xScaleT2:Tween = new Tween(su2, "_y", Strong .easeOut, 60, 30, hiz-2, false);
 var xPosT2:Tween = new Tween(su2, "_x", Regular .easeOut, 90, xson-10, hiz-2, false);
 var xScaleT3:Tween = new Tween(su3, "_y", Strong .easeOut, 60, 35, hiz-4, false);
 var xPosT3:Tween = new Tween(su3, "_x", Regular .easeOut, 90, xson-20, hiz-4, false);
 var xScaleT4:Tween = new Tween(su4, "_y", Strong .easeOut, 60, 40, hiz-6, false);
 var xPosT4:Tween = new Tween(su4, "_x", Regular .easeOut, 90, xson-30, hiz-6, false);
 var xScaleT5:Tween = new Tween(su5, "_y", Strong .easeOut, 60, 45, hiz-8, false);
 var xPosT5:Tween = new Tween(su5, "_x", Regular .easeOut, 90, xson-40, hiz-8, false);
 var xScaleT6:Tween = new Tween(su6, "_y", Strong .easeOut, 60, 50, hiz-10, false);
 var xPosT6:Tween = new Tween(su6, "_x", Regular .easeOut, 90, xson-50, hiz-10, false);
 var xScaleT7:Tween = new Tween(su7, "_y", Strong .easeOut, 60, 55, hiz-12, false);
 var xPosT7:Tween = new Tween(su7, "_x", Regular .easeOut, 90, xson-60, hiz-12, false);
 var xScaleT8:Tween = new Tween(su8, "_y", Strong .easeOut, 60, 60, hiz-14, false);
 var xPosT8:Tween = new Tween(su8, "_x", Regular .easeOut, 90, xson-70, hiz-14, false);
 //
 xScaleT.onMotionFinished = function() {
  xScaleT.start();
 };
 xPosT.onMotionFinished = function() {
  xPosT.start();
 };
 xScaleT2.onMotionFinished = function() {
  xScaleT2.start();
 };
 xPosT2.onMotionFinished = function() {
  xPosT2.start();
 };
 xScaleT3.onMotionFinished = function() {
  xScaleT3.start();
 };
 xPosT3.onMotionFinished = function() {
  xPosT3.start();
 };
 xScaleT4.onMotionFinished = function() {
  xScaleT4.start();
 };
 xPosT4.onMotionFinished = function() {
  xPosT4.start();
 };
 xScaleT5.onMotionFinished = function() {
  xScaleT5.start();
 };
 xPosT5.onMotionFinished = function() {
  xPosT5.start();
 };
 xScaleT6.onMotionFinished = function() {
  xScaleT6.start();
 };
 xPosT6.onMotionFinished = function() {
  xPosT6.start();
 };
 xScaleT7.onMotionFinished = function() {
  xScaleT7.start();
 };
 xPosT7.onMotionFinished = function() {
  xPosT7.start();
 };
 xScaleT8.onMotionFinished = function() {
  xScaleT8.start();
 };
 xPosT8.onMotionFinished = function() {
  xPosT8.start();
 };
 
// Basla tuşu
_root.Kumanda.btnBasla.onRelease=function(){
  efekt();
}
 
// Dur tuşu
_root.Kumanda.btnDur.onRelease=function(){
  // Nasıl yapacağımı bilemedim...
}
 
// Değiştir tuşu
_root.Kumanda.btnDegistirr.onRelease=function(){
  //  "xson" and "hiz" değerleri değişip animasyon yeniden başlayacak veya kaldığı yerden yeni değerlerle devam edicek(böylesi daha iyi olur)
  // Nasıl yapacağımı bilemedim...
}
 

hardnheavy

🌱Yeni Üye🌱
Katılım
31 Tem 2009
Mesajlar
3
Tepkime puanı
0
Dostlar ben bu tween in çalışma prensibini hala tam anlayamadım ondan dolayı galiba burda takıldım. Bana bi yardımcı olsanız, buraya kadarda zaten çok uğraşlarla kodladım :)
 
Üst