File tree Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Expand file tree Collapse file tree 2 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,16 @@ $turtle | Save-Turtle ./Square.svg
107
107
~~~
108
108
109
109
This just demonstrates how we can construct shapes out of these two simple primitive steps.
110
+
110
111
We can also just say, make a square directly:
111
112
112
113
~~~ PowerShell
113
114
New-Turtle | Move-Turtle Square 10 | Save-Turtle ./Square.svg
114
115
~~~
115
- We can use loops:
116
+
117
+ We can use the same techniques to construct other shapes.
118
+
119
+ For example, this builds us a hexagon:
116
120
117
121
~~~ PowerShell
118
122
$turtle = New-Turtle
@@ -187,7 +191,6 @@ Lets show the first three generations of the box fractal:
187
191
~~~
188
192
189
193
190
- @"
191
194
<div align =' center ' >
192
195
<img src =' ./Examples/BoxFractal1.svg ' alt =' Box Fractal 1 ' width =' 50% ' />
193
196
<img src =' ./Examples/BoxFractal2.svg ' alt =' Box Fractal 2 ' width =' 50% ' />
@@ -209,5 +212,13 @@ For example, here is an example of a pattern comprised of Koch Snowflakes:
209
212
<div align =' center ' >
210
213
<img src =' ./Examples/KochSnowflakePattern.svg ' alt =' Snowflake Pattern ' width =' 50% ' />
211
214
</div >
215
+ We can also animate the pattern, for endless variety:
216
+
217
+ ~~~ PowerShell
218
+ $turtle = turtle KochSnowflake 10 4 | Set-Turtle -Property PatternTransform -Value @{scale=0.33} | set-turtle -property Fill -value '#4488ff' | Set-Turtle -Property PatternAnimation -Value " <animateTransform attributeName='patternTransform' attributeType='XML' type='scale' values='0.66;0.33;0.66' dur='23s' repeatCount='indefinite' additive='sum' /> <animateTransform attributeName='patternTransform' attributeType='XML' type='rotate' from='0' to='360' dur='41s' repeatCount='indefinite' additive='sum' /> <animateTransform attributeName='patternTransform' attributeType='XML' type='skewX' values='30;-30;30' dur='83s' repeatCount='indefinite' additive='sum' /> <animateTransform attributeName='patternTransform' attributeType='XML' type='skewY' values='30;-30;30' dur='103s' repeatCount='indefinite' additive='sum' /> <animateTransform attributeName='patternTransform' attributeType='XML' type='translate' values='0 0;42 42;0 0' dur='117s' repeatCount='indefinite' additive='sum' /> " $turtle | save-turtle -Path ./EndlessSnowflake.svg -Property Pattern Pop-Location
219
+ ~~~
220
+ <div align =' center ' >
221
+ <img src =' ./Examples/EndlessSnowflake.svg ' alt =' Endless Snowflake Pattern ' width =' 100% ' />
222
+ </div >
212
223
![ SierpinskiTriangle] ( ./Examples/EndlessSierpinskiTrianglePattern.svg )
213
224
Original file line number Diff line number Diff line change @@ -147,8 +147,8 @@ This just demonstrates how we can construct shapes out of these two simple primi
147
147
'@
148
148
149
149
150
-
151
150
@'
151
+
152
152
We can also just say, make a square directly:
153
153
154
154
~~~PowerShell
@@ -159,7 +159,10 @@ New-Turtle | Move-Turtle Square 10 | Save-Turtle ./Square.svg
159
159
160
160
161
161
@'
162
- We can use loops:
162
+
163
+ We can use the same techniques to construct other shapes.
164
+
165
+ For example, this builds us a hexagon:
163
166
164
167
~~~PowerShell
165
168
$turtle = New-Turtle
274
277
)
275
278
)
276
279
277
- @"
278
280
<div align='center'>
279
281
<img src='./Examples/BoxFractal1.svg' alt='Box Fractal 1' width='50%' />
280
282
<img src='./Examples/BoxFractal2.svg' alt='Box Fractal 2' width='50%' />
@@ -313,6 +315,22 @@ $SnowFlakePattern = . $MakeSnowflakePattern
313
315
</div>
314
316
"@
315
317
318
+ @"
319
+ We can also animate the pattern, for endless variety:
320
+
321
+ ~~~PowerShell
322
+ $ (
323
+ Get-Content ./ Examples/ EndlessSnowflake.turtle.ps1 |
324
+ Select-Object - Skip 1
325
+ )
326
+ ~~~
327
+ "@
328
+
329
+ @"
330
+ <div align='center'>
331
+ <img src='./Examples/EndlessSnowflake.svg' alt='Endless Snowflake Pattern' width='100%' />
332
+ </div>
333
+ "@
316
334
317
335
# endregion LSystems
318
336
You can’t perform that action at this time.
0 commit comments