JürgenB: Animation mit setTimeOut verzögert nicht

Beitrag lesen

Hallo Matthias,

Leider verzögert ...

function animation_loop() {

Gesicht(ctx,xoff,0);
    window.setTimeout(function() { i++; if (i < n) { animation_loop(); } }, 30000);
};


>   
> ... das window.setTimeout nicht wie beabsichtigt.  
  
das ist auch kein Wunder, da du hier  
~~~javascript
  
function init(){  
	ctx.clearRect(0,0,520,110);  
	while(xoff < 390) {  
		//alert (xoff);  
		animation_loop();  
		// window.setTimeout("Gesicht()", 3000);  
		xoff = xoff +1;  
	}  
}

du Funktion animation_loop(); so schnell wie möglich 390 mal aufrufst. Du musst animation_loop(); nur einmal aufrufen und xoff = xoff +1; in animation_loop() ausführen.

Ich kann leider trotz googeln das Problem nicht erkennen.

Jetzt mal Hand aufs Herz: woher soll Google die Fehler in deinem Programm kennen?

Gruß, Jürgen