normalizing angles to prevent drift

also move the at least one frame check to the AnimationSpeed creation.
This commit is contained in:
2025-10-10 09:26:18 +02:00
parent 5799d2aa07
commit c3f5136359
6 changed files with 84 additions and 41 deletions
+2 -2
View File
@@ -23,17 +23,17 @@ async fn main() {
let mut plan = create_turtle();
// Position turtle
plan.set_speed(1001);
plan.pen_up();
plan.backward(150.0);
plan.pen_down();
plan.set_speed(10000);
// Draw Koch snowflake (triangle of Koch curves)
for _ in 0..3 {
koch(4, &mut plan, 300.0);
plan.right(120.0);
plan.set_speed(1000);
plan.set_speed(1200);
}
plan.hide(); // Hide turtle when done
+4 -3
View File
@@ -8,10 +8,11 @@ async fn main() {
// Create a turtle plan
let mut plan = create_turtle();
plan.shape(ShapeType::Turtle);
plan.set_speed(800);
plan.set_speed(1500);
plan.set_pen_width(0.5);
// Draw a square
for _ in 0..5 {
// Draw a 5-pointed star pattern repeatedly
for _i in 0..50000 {
plan.forward(200.0);
plan.circle_left(10.0, 72.0, 1000);
plan.circle_right(5.0, 360.0, 1000);