canvas.clear(); // Zeichenfläche löschen var drunken = new Turtle(1); drunken.penColor(255,0,0); drunken.home(); drunken.right(90); var follower = new Turtle(1); follower.penColor(0,255,0); follower.move(200,0); for(var step = 0; step < 1000; step++) { follower.setAngleTo(drunken); follower.forward(2); drunken.forward( (20 * Math.random()) ); if (step%2 == 0) drunken.right( (180 * Math.random()) ); else drunken.left( (180 * Math.random()) ); }
ausführen