File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ <#
2+ . SYNOPSIS
3+ Gets the duration
4+ . DESCRIPTION
5+ Gets the default duration of animations and morphs.
6+ #>
7+ if ($this .' .Duration' ) { return $this .' .Duration' }
8+ return
Original file line number Diff line number Diff line change 1+ <#
2+ . SYNOPSIS
3+ Sets the duration
4+ . DESCRIPTION
5+ Sets the default duration used for morphs and other animations.
6+ #>
7+ param (
8+ # The value to set
9+ $value
10+ )
11+
12+ foreach ($v in $value ) {
13+ if ($v -is [Timespan ]) {
14+ $this | Add-Member NoteProperty ' .Duration' $v - Force
15+ } elseif ($v -is [double ] -or $v -is [int ]) {
16+ $this | Add-Member NoteProperty ' .Duration' ([TimeSpan ]::FromSeconds($v )) - Force
17+ } else {
18+ Write-Warning " '$Value ' is not a number or timespan"
19+ }
20+ }
21+
Original file line number Diff line number Diff line change @@ -36,6 +36,11 @@ $newAnimation = @(foreach ($animation in $PathAnimation) {
3636 if ($animationCopy [' attributeName' ] -eq ' transform' ) {
3737 $elementName = ' animateTransform'
3838 }
39+
40+
41+ if (-not $animationCopy [' dur' ] -and $this.Duration ) {
42+ $animationCopy [' dur' ] = " $ ( $this.Duration.TotalSeconds ) s"
43+ }
3944
4045 " <$elementName $ (
4146 @ (foreach ($key in $animationCopy.Keys ) {
You can’t perform that action at this time.
0 commit comments