Skip to content

Commit 8bef1f2

Browse files
author
James Brundage
committed
feat: Turtle.get_Pattern transform and animation updates ( Fixes #26, Fixes #27 )
1 parent 36f107a commit 8bef1f2

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

Types/Turtle/get_Pattern.ps1

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
param()
2-
@(
2+
$segments = @(
33
$viewX = [Math]::Max($this.Maximum.X, $this.Minimum.X * -1)
44
$viewY = [Math]::Max($this.Maximum.Y, $this.Minimum.Y * -1)
55
"<svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%'>"
66
"<defs>"
7-
"<pattern id='turtle-pattern' patternUnits='userSpaceOnUse' width='$viewX' height='$viewY' transform-origin='50% 50%'>"
7+
"<pattern id='turtle-pattern' patternUnits='userSpaceOnUse' width='$viewX' height='$viewY' transform-origin='50% 50%'$(
8+
if ($this.PatternTransform) {
9+
" patternTransform='" + (
10+
@(foreach ($key in $this.PatternTransform.Keys) {
11+
"$key($($this.PatternTransform[$key]))"
12+
}) -join ' '
13+
) + "'"
14+
}
15+
)>"
16+
$(if ($this.PatternAnimation) { $this.PatternAnimation })
817
"<path id='turtle-path' d='$($this.PathData)' stroke='$(
918
if ($this.Stroke) { $this.Stroke } else { 'black' }
1019
)' fill='transparent'/>"
1120
"</pattern>"
1221
"</defs>"
1322
"<rect width='10000%' height='10000%' x='-5000%' y='-5000%' fill='url(#turtle-pattern)' />"
14-
"</svg>") -join '' -as [xml]
23+
"</svg>")
24+
25+
$segments -join '' -as [xml]

0 commit comments

Comments
 (0)