Small Basic Art with Turtle
I think we can create a lot of art with Turtle. Following list is a sample.
GraphicsWindow``.`` Title `` = ``"Turtle Randome Drawing"
GraphicsWindow``.`` BackgroundColor `` = ``"Black"
gw `` = ``598
gh `` = ``428
xo `` = `` gw `` / ``2
yo `` = `` gh `` / ``2
GraphicsWindow``.`` Width `` = ``gw
GraphicsWindow``.`` Height `` = ``gh
GraphicsWindow``.`` PenWidth `` = ``1
GraphicsWindow``.`` PenColor `` = ``"LightGray"
Turtle``.`` Speed `` = ``10
Turtle``.`` X `` = ``xo
Turtle``.`` Y `` = ``yo
distance `` = ``20
For `` i `` = `` 1 `` To ``10000
`` angle `` = ``Math``.``GetRandomNumber``(``360``)
`` _angle `` = ``Math``.``GetRadians``(``angle``)
`` x `` = ``Turtle``.`` X `` + `` distance `` * ``Math``.``Sin``(``_angle``)
`` y `` = ``Turtle``.`` Y `` - `` distance `` * ``Math``.``Cos``(``_angle``)
`` r `` = ``Math``.``SquareRoot``(``(`` xo `` - ``x`` ) `` * ``(`` xo `` - ``x`` ) `` + ``(`` yo `` - ``y`` ) `` * ``(`` yo `` - ``y``)``)
`` If `` r ``<`` = ``(`` gh `` / `` 2 `` - ``20`` ) ``Then
`` red `` = ``Math``.``GetRandomNumber``(``128``)
`` green `` = ``Math``.``GetRandomNumber``(``255``)
`` blue `` = ``255
``GraphicsWindow``.`` PenColor `` = ``GraphicsWindow``.``GetColorFromRGB``(``red`` , ``green`` , ``blue``)
``Turtle``.`` Angle `` = ``angle
``Turtle``.``Move``(``distance``)
``EndIf
EndFor
How do you feel?
Comments
- Anonymous
June 27, 2016
update: chz459-0turtle is great to draw, but too slow, even et speed 10. thus is better to use quicker way, as i use "t_move" in this sample.LD xtension is neccessary, as usual)) - Anonymous
June 28, 2016
Fantastic, excellent idea !! - Anonymous
June 28, 2016
lace flower: GMG063