caZpa
Account gelöscht Threadersteller
Ort: -
|
Verfasst Do 24.08.2006 07:41
Titel [FLASH] MovieClip wird immer langsamer [erledigt] |
|
|
ich bastel gerade eine oszilloskop-animation.
bis jetzt wird eine rechteck und eine dreieck kurve
auf 2 seperaten movieclips gezeichnet. man kann
die amplitude und die frequenz einstellen.
hier die swf datei: http://herz-as.net/oszilloskop.swf
hat die kurve das ende erreicht, wird wieder von
vorne angefangen zu zeichnen, wobei die voherige
kurve natürlich erhalten bleibt.
wenn man dann die werte ändert, gibt es ein durch-
einander, weil die kurven sich überlagern. also geht
der laufenden kurve eine weiße fläche voraus. aber
die animation wird dadurch immer langsamer, da
die clips ja gegen unendlich übermalt werden.
kann man das irgendwie lösen oder seid ihr genauso ratlos?
hier der code nur mit funktion für die rechteck-kurve
die dreieck ist ja vom prinzip gleich
Code: | // Rechteck
var x_squ = 50;
var y_squ = -75;
freq_squ.text = 5;
ampl_squ.text = 15;
clip_squ = this.createEmptyMovieClip("rechteck" , 2);
border.swapDepths(11); // rahmen ganz oben
this.onEnterFrame = function() {
paintTriangle();
paintSquare();
};
function paintSquare() {
var freq;
var ampl;
if(_root.freq_squ >= 30) { // mehr als 30 geht nicht
_root.freq_squ = 30;
}
if(_root.ampl_squ >= 20) { // mehr als 20 geht nicht
_root.ampl_squ = 20;
}
freq = Math.abs(_root.freq_squ);
ampl = Math.abs(_root.ampl_squ);
//weiße fläche für sauberes übermalen
clip_squ.beginFill(0xffffff, 100);
clip_squ.lineStyle(0, 0x000000, 0);
clip_squ.moveTo(x_squ, -y_squ-25);
clip_squ.lineTo(x_squ+freq*2, -y_squ-25);
clip_squ.lineTo(x_squ+freq*2, -y_squ+25);
clip_squ.lineTo(x_squ, -y_squ+25);
clip_squ.endFill();
//kurve
clip_squ.lineStyle(1, 0x3653A6, 100);
clip_squ.moveTo(x_squ, -y_squ);
clip_squ.lineTo(x_squ, -y_squ);
y_squ += ampl;
clip_squ.lineTo(x_squ, -y_squ);
x_squ += freq;
clip_squ.lineTo(x_squ, -y_squ);
y_squ -= ampl;
clip_squ.lineTo(x_squ, -y_squ);
y_squ -= ampl;
clip_squ.lineTo(x_squ, -y_squ);
x_squ += freq;
clip_squ.lineTo(x_squ, -y_squ);
y_squ += ampl;
clip_squ.lineTo(x_squ, -y_squ);
//wenn ende - zum anfang
if(x_squ>=320){
x_squ=50;
//clip_squ.clear();
}
} |
hilfe— = eyecatcher?!
alles klar...
naja, jeden falls wurde mir ne lösung gefunden
2mcs; wenn das ende erreicht ist, anderen mc wählen, nach vorne und leeren
Code: |
clip_squ = this.createEmptyMovieClip("rechteck1" , 2);
this.createEmptyMovieClip("rechteck2" , 3);
var sq_num = 1;
this.onEnterFrame = function() {
paintTriangle();
paintSquare();
};
function paintSquare() {
[...]
//wenn ende - zum anfang
if(x_squ>=320){
x_squ=50;
sq_num = 3-sq_num;
clip_squ = this["rechteck"+sq_num];
clip_squ.swapDepths(10);
clip_squ.clear();
}
} |
Zuletzt bearbeitet von am Do 24.08.2006 09:36, insgesamt 3-mal bearbeitet
|
|