#TODO: ( code modified you now pass sketcher to a new Turtle instance ) but theory below is very similar.
demo project: https://github.com/nanjizal/cornerContourWebGLTurtle
Sometimes it can be easier to draw using simple turtle graphics. Turtle style graphics allows you to define drawing as if your controlling a turtle, with rotation and movement commands, these commands can be chained together as a sequence:
public function turtleTest(){
var s = new Sketcher( pen2D, Fine, both );
s.setPosition( 100, 100 )
.penSize( 7 )
.forward( 30 )
.right( 45 )
.forward( 30 )
.arc( 50, 120 );
}
Specific turtle related commands provided from Sketcher class, these are designed to be easily chained. There is a simple repeat that allows non nested multiple repeat of commands.
s.penUp();
s.penDow();
s.movePen(100,100);
s.left( 45 );
s.right( 45 );
s.north();
s.south();
s.east();
s.west();
s.setAngle( 90 )
s.forward( 100 );
s.backward( 100 );
s.setPosition( 300, 300 );
s.circle( 100 );
var square = 4; // untested
s.circle( 100, square );
s.arc( 100, 45 );// quarter pie
// pentagram or star?
s.repeatBegin( 7 ).forward( 300 ).right( 144 ).endRepeat();
// can experiment with forward commands changing size in loop iteration
s.forward(300).right(144).repeatBegin( 6 ).forwardChange( -10 ).right( 144 ).endRepeat();
s.penSize( 50 ); //very thick line
s.penColor( 1, 0, 0 ); // red pen
s.circle( 100 );
s.plum(); // plum colored circle
s.circle();
![]()
s.fillOn();
s.circle( 100 ); // dot
s.fillOff();