mrdimosthenis / turtle-graphics / TurtleGraphics

This is an Elm library that enables us command a relative cursor ("turtle") to draw vector graphics!

Definition


type alias Command =
Core.Command

Command is the building block of the turtle graphics. Every function, except render and branch, is a command that change the location, direction, width and color of the relative cursor ("turtle").

Commands

move : Basics.Float -> Command

Moves the turtle forward by x pixels.

turn : Basics.Float -> Command

Changes the turtle's direction by x degrees (counterclockwise). The initial direction is "left-to-right".

increaseWidth : Basics.Float -> Command

Changes the stroke width of the turtle's pen by x pixels. The initial value is 1.0 pixel. Providing a negative number will decrease the stroke width.

rotateHue : Basics.Float -> Command

Rotates the hue of the turtle's pen by x. Hue values range between 0.0 and 1.0. The initial color of the pen is black (hue = 0.0).

increaseSaturation : Basics.Float -> Command

Increases the saturation of the turtle's pen by x. Saturation values range between 0.0 and 1.0. The initial color of the pen is black (saturation = 0.0). Providing a negative number will decrease the saturation.

increaseLightness : Basics.Float -> Command

Increases the lightness of the turtle's pen by x. Lightness values range between 0.0 and 1.0. The initial color of the pen is black (lightness = 0.0). Providing a negative number will decrease the saturation.

increaseAlpha : Basics.Float -> Command

Increases the alpha value of the turtle's pen by x. Alpha ranges between 0.0 and 1.0. The initial alpha value of the pen is 1.0). Providing a negative number will increase the transparency.

increaseRed : Basics.Float -> Command

Increases the percentage of red by x. The percentage of red ranges between 0.0 and 1.0. The initial color of the pen is black (red pct = 0.0). Providing a negative number will decrease the percentage of red.

increaseGreen : Basics.Float -> Command

Increases the percentage of green by x. The percentage of green ranges between 0.0 and 1.0. The initial color of the pen is black (green pct = 0.0). Providing a negative number will decrease the percentage of green.

increaseBlue : Basics.Float -> Command

Increases the percentage of blue by x. The percentage of blue ranges between 0.0 and 1.0. The initial color of the pen is black (blue pct = 0.0). Providing a negative number will decrease the percentage of blue.

branch : List Command -> Command

Turns a list of commands into a single Command.

Render

render : Color -> Command -> Html msg

Takes a background color and a Command (usually a branch of commands) and renders it to Html using Svg.