File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change 5
5
Draws a flower pattern in turtle graphics.
6
6
7
7
This pattern consists of a series of polygons and rotations to create a flower-like design.
8
+ . EXAMPLE
9
+ turtle Flower 42
8
10
. EXAMPLE
9
- $turtle = New-Turtle
10
- $turtle.Flower(100, 10, 5, 36)
11
- $turtle.Pattern.Save("$pwd/FlowerPattern.svg")
11
+ turtle Flower 42 20 6 18
12
12
. EXAMPLE
13
- Move-Turtle Flower |
14
- Save-Turtle ./FlowerSymbol.svg
13
+ turtle Flower 42 20 6 18
14
+ . EXAMPLE
15
+ # We can make Flowers with partial polygons
16
+ turtle Flower 42 20 6.6 18
17
+ . EXAMPLE
18
+ # They are surprisingly beautiful
19
+ turtle Flower 42 30 7.7 12
15
20
#>
16
21
param (
22
+ # The size of the base shape
17
23
[double ]$Size = 100 ,
24
+ # The rotation after each step
18
25
[double ]$Rotation = 10 ,
26
+ # The number of sides in each shape
19
27
[double ]$SideCount = 4 ,
20
- [double ]$StepCount = 36
28
+ # The number of steps in the flower.
29
+ [int ]$StepCount = 36
21
30
)
22
31
23
- $null = foreach ($n in 1 .. $StepCount ) {
32
+ $null = foreach ($n in 1 .. ([ Math ]::Abs( $StepCount )) ) {
24
33
$this.Polygon ($Size , $SideCount )
25
34
$this.Rotate ($Rotation )
26
35
}
You can’t perform that action at this time.
0 commit comments