Skip to content

Commit 8f2b648

Browse files
docs: Morphing examples ( Fixes #154 )
1 parent bf85f5d commit 8f2b648

File tree

1 file changed

+27
-3
lines changed

1 file changed

+27
-3
lines changed

Commands/Get-Turtle.ps1

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,32 @@ function Get-Turtle {
8787
$sideCount
8888
}
8989
)
90+
.EXAMPLE
91+
# We can morph any N shapes with the same number of points.
92+
turtle square 42 morph @(
93+
turtle square 42
94+
turtle rotate 45 square 42
95+
turtle square 42
96+
)
97+
.EXAMPLE
98+
# This animates the path of the turtle.
99+
# If we want to morph a smaller shape into a bigger shape,
100+
# we can duplicate more lines
101+
turtle polygon 21 6 morph @(
102+
turtle @('forward', 21,'backward', 21 * 3)
103+
turtle polygon 21 6
104+
turtle @('forward', 21,'backward', 21 * 3)
105+
)
106+
.EXAMPLE
107+
# We can repeat steps by multiplying arrays.
108+
# Lets repeat a hexagon three times with a rotation
109+
turtle ('polygon', 23, 6, 'rotate', -120 * 3)
110+
.EXAMPLE
111+
# Let's change the angle a bit and see how they overlap
112+
turtle ('polygon', 23, 6, 'rotate', -60 * 6)
113+
.EXAMPLE
114+
# Let's do the same thing, but with a smaller angle
115+
turtle ('polygon', 23, 6, 'rotate', -40 * 9)
90116
.EXAMPLE
91117
# A flower is a series of repeated polygons and rotations
92118
turtle Flower
@@ -99,9 +125,7 @@ function Get-Turtle {
99125
.EXAMPLE
100126
# Flowers get more dense as we decrease the angle and increase the repetitions.
101127
turtle Flower 50 5 (3..12 | Get-Random) 72
102-
.EXAMPLE
103-
# We can morph any two similar shapes.
104-
#
128+
.EXAMPLE
105129
# Flowers look especially beautiful as they morph
106130
$sideCount = (3..12 | Get-Random)
107131
turtle Flower 50 15 $sideCount 36 morph @(

0 commit comments

Comments
 (0)