Skip to content

Commit fd31969

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.get/set_Opacity ( Fixes #115 )
1 parent c643e65 commit fd31969

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Turtle.types.ps1xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,6 +1687,42 @@ return ([pscustomobject]@{ X = 0; Y = 0 })
16871687
"offset-path: $($this.PathData);"
16881688
</GetScriptBlock>
16891689
</ScriptProperty>
1690+
<ScriptProperty>
1691+
<Name>Opacity</Name>
1692+
<GetScriptBlock>
1693+
&lt;#
1694+
.SYNOPSIS
1695+
Gets the turtle opacity
1696+
.DESCRIPTION
1697+
Gets the opacity of the turtle path.
1698+
#&gt;
1699+
if (-not $this.'.PathAttribute') {
1700+
$this | Add-Member -MemberType NoteProperty -Name '.PathAttribute' -Value ([Ordered]@{}) -Force
1701+
}
1702+
if ($this.'.PathAttribute'.'opacity') {
1703+
return $this.'.PathAttribute'.'opacity'
1704+
} else {
1705+
return 1.0
1706+
}
1707+
</GetScriptBlock>
1708+
<SetScriptBlock>
1709+
&lt;#
1710+
.SYNOPSIS
1711+
Sets the opacity
1712+
.DESCRIPTION
1713+
Sets the opacity of the path
1714+
.EXAMPLE
1715+
turtle forward 100 opacity 0.5 save ./dimLine.svg
1716+
#&gt;
1717+
param(
1718+
[double]
1719+
$Opacity = 'nonzero'
1720+
)
1721+
1722+
$this.PathAttribute = [Ordered]@{'opacity' = $Opacity}
1723+
1724+
</SetScriptBlock>
1725+
</ScriptProperty>
16901726
<ScriptProperty>
16911727
<Name>PathAttribute</Name>
16921728
<GetScriptBlock>

0 commit comments

Comments
 (0)