Skip to content

Commit b30e336

Browse files
author
James Brundage
committed
feat: Turtle.TwinDragonCurve ( Fixes #35 )
2 parents 92cd4a7 + 4e071f1 commit b30e336

File tree

1 file changed

+33
-15
lines changed

1 file changed

+33
-15
lines changed

Turtle.types.ps1xml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,21 @@ $this | Add-Member -MemberType NoteProperty -Force -Name '.TurtleHeading' -Valu
219219

220220
</SetScriptBlock>
221221
</ScriptProperty>
222+
<ScriptProperty>
223+
<Name>Mask</Name>
224+
<GetScriptBlock>
225+
$segments = @(
226+
"&lt;svg xmlns='http://www.w3.org/2000/svg' width='0%' height='0%'&gt;"
227+
"&lt;defs&gt;"
228+
"&lt;mask id='turtle-mask'&gt;"
229+
$this.Symbol.OuterXml -replace '\&lt;\?[^\&gt;]+\&gt;'
230+
"&lt;/mask&gt;"
231+
"&lt;/defs&gt;"
232+
"&lt;/svg&gt;"
233+
)
234+
[xml]($segments -join '')
235+
</GetScriptBlock>
236+
</ScriptProperty>
222237
<ScriptProperty>
223238
<Name>Maximum</Name>
224239
<GetScriptBlock>
@@ -303,11 +318,7 @@ $null, $null, $viewX, $viewY = $viewBox
303318
}
304319
)&gt;"
305320
$(if ($this.PatternAnimation) { $this.PatternAnimation })
306-
"&lt;path id='turtle-path' d='$($this.PathData)' stroke='$(
307-
if ($this.Stroke) { $this.Stroke } else { 'black' }
308-
)' stroke-width='$(
309-
if ($this.StrokeWidth) { $this.StrokeWidth } else { '0.1%' }
310-
)' fill='transparent' class='foreground-stroke' /&gt;"
321+
$this.PathElement.OuterXml
311322
"&lt;/pattern&gt;"
312323
"&lt;/defs&gt;"
313324
"&lt;rect width='10000%' height='10000%' x='-5000%' y='-5000%' fill='url(#turtle-pattern)' /&gt;"
@@ -334,6 +345,21 @@ $this | Add-Member -MemberType NoteProperty -Force -Name '.PatternAnimation' -Va
334345

335346
</SetScriptBlock>
336347
</ScriptProperty>
348+
<ScriptProperty>
349+
<Name>PatternMask</Name>
350+
<GetScriptBlock>
351+
$segments = @(
352+
"&lt;svg xmlns='http://www.w3.org/2000/svg' width='0%' height='0%'&gt;"
353+
"&lt;defs&gt;"
354+
"&lt;mask id='turtle-mask'&gt;"
355+
$this.Pattern.OuterXml -replace '\&lt;\?[^\&gt;]+\&gt;'
356+
"&lt;/mask&gt;"
357+
"&lt;/defs&gt;"
358+
"&lt;/svg&gt;"
359+
)
360+
[xml]($segments -join '')
361+
</GetScriptBlock>
362+
</ScriptProperty>
337363
<ScriptProperty>
338364
<Name>PatternTransform</Name>
339365
<GetScriptBlock>
@@ -449,11 +475,7 @@ $this | Add-Member -MemberType NoteProperty -Force -Name '.StrokeWidth' -Value $
449475
param()
450476
@(
451477
"&lt;svg xmlns='http://www.w3.org/2000/svg' viewBox='$($this.ViewBox)' transform-origin='50% 50%' width='100%' height='100%'&gt;"
452-
"&lt;path id='turtle-path' transform-origin='50% 50%' d='$($this.PathData)' stroke='$(
453-
if ($this.Stroke) { $this.Stroke } else { '#4488ff' }
454-
)' stroke-width='$(
455-
if ($this.StrokeWidth) { $this.StrokeWidth } else { '0.1%' }
456-
)' fill='transparent'/&gt;"
478+
$this.PathElement.OuterXml
457479
"&lt;/svg&gt;"
458480
) -join '' -as [xml]
459481
</GetScriptBlock>
@@ -466,11 +488,7 @@ $this | Add-Member -MemberType NoteProperty -Force -Name '.StrokeWidth' -Value $
466488
@(
467489
"&lt;svg xmlns='http://www.w3.org/2000/svg' width='100%' height='100%'&gt;"
468490
"&lt;symbol id='turtle-symbol' viewBox='$($this.ViewBox)' transform-origin='50% 50%'&gt;"
469-
"&lt;path id='turtle-path' transform-origin='50% 50%' d='$($this.PathData)' stroke='$(
470-
if ($this.Stroke) { $this.Stroke } else { 'black' }
471-
)' stroke-width='$(
472-
if ($this.StrokeWidth) { $this.StrokeWidth } else { '0.1%' }
473-
)' fill='transparent'/&gt;"
491+
$this.PathElement.OuterXml
474492
"&lt;/symbol&gt;"
475493
"&lt;use href='#turtle-symbol' width='100%' height='100%' /&gt;"
476494
"&lt;/svg&gt;"

0 commit comments

Comments
 (0)