Skip to content

Commit 08bd950

Browse files
StartAutomatingStartAutomating
authored andcommitted
feat: Turtle.get/set_AnimateMotionDuration ( Fixes PoshWeb#43 )
1 parent 26217ec commit 08bd950

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Turtle.types.ps1xml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,36 @@ return $this.L('FX+FX+', [Ordered]@{
472472
)' repeatCount='indefinite' path='$($this.PathData)' />") -as [xml]
473473
</GetScriptBlock>
474474
</ScriptProperty>
475+
<ScriptProperty>
476+
<Name>AnimateMotionDuration</Name>
477+
<GetScriptBlock>
478+
if ($this.'.AnimateMotionDuration') {
479+
return $this.'.AnimateMotionDuration'
480+
}
481+
$thesePoints = $this.Points
482+
if ($thesePoints.Length -eq 0) {
483+
return "$(($thesePoints.Length / 2 / 10))s"
484+
}
485+
486+
</GetScriptBlock>
487+
<SetScriptBlock>
488+
param(
489+
[PSObject]
490+
$AnimateMotionDuration
491+
)
492+
493+
if ($AnimateMotionDuration -is [TimeSpan]) {
494+
$AnimateMotionDuration = $AnimateMotionDuration.TotalSeconds + 's'
495+
}
496+
497+
if ($AnimateMotionDuration -is [int] -or $AnimateMotionDuration -is [double]) {
498+
$AnimateMotionDuration = "${AnimateMotionDuration}s"
499+
}
500+
501+
$this | Add-Member -MemberType NoteProperty -Force -Name '.AnimateMotionDuration' -Value $AnimateMotionDuration
502+
503+
</SetScriptBlock>
504+
</ScriptProperty>
475505
<ScriptProperty>
476506
<Name>Heading</Name>
477507
<GetScriptBlock>

0 commit comments

Comments
 (0)