pub fn new(ctx: CanvasRenderingContext2d, program: &dyn TurtleProgram) -> TurtleAnimation {
        let mut turtle = CanvasTurtle::new(TurtleState::new(), ctx);

        let init_turtle_steps = program.init_turtle();
        for action in init_turtle_steps {
            turtle.perform(action)
        }

        let iter = program.turtle_program_iter().collect_to_next_forward();

        TurtleAnimation { turtle, iter }
    }
/// Build a TurtleAnimation from a canvas element and a boxed turtle program.
///
/// The TurtleProgram is copied and boxed (via its `turtle_program_iter`) to to avoid
/// TurtleAnimation being generic.
Build a TurtleAnimation from a canvas element and a boxed turtle program.
The TurtleProgram is copied and boxed (via its `turtle_program_iter`) to to avoid
TurtleAnimation being generic.
Build a TurtleAnimation from a canvas element and a boxed turtle program . The TurtleProgram is copied and boxed ( via its ` turtle_program_iter ` ) to to avoid TurtleAnimation being generic .
pub fn new(ctx: CanvasRenderingContext2d, program: &dyn TurtleProgram) -> TurtleAnimation {
        let mut turtle = CanvasTurtle::new(TurtleState::new(), ctx);
        let init_turtle_steps = program.init_turtle();
        for action in init_turtle_steps {
            turtle.perform(action)
        }
        let iter = program.turtle_program_iter().collect_to_next_forward();
        TurtleAnimation { turtle, iter }
    }
pub fn new ( ctx : CanvasRenderingContext2d , program : & dyn TurtleProgram ) -> TurtleAnimation { let mut turtle = CanvasTurtle :: new ( TurtleState :: new ( ) , ctx ) ; let init_turtle_steps = program . init_turtle ( ) ; for action in init_turtle_steps { turtle . perform ( action ) } let iter = program . turtle_program_iter ( ) . collect_to_next_forward ( ) ; TurtleAnimation { turtle , iter } }
Build a TurtleAnimation from a canvas element and a boxed turtle program.
Build a TurtleAnimation from a canvas element and a boxed turtle program .
ctx
CanvasRenderingContext2d
program
&dyn TurtleProgram