File tree Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Expand file tree Collapse file tree 3 files changed +42
-2
lines changed Original file line number Diff line number Diff line change
1
+ if ($this .' .PathAnimation' ) {
2
+ return $this .' .PathAnimation'
3
+ }
Original file line number Diff line number Diff line change 5
5
if ($this.StrokeWidth ) { $this.StrokeWidth } else { ' 0.1%' }
6
6
) ' fill='$ ( $this.Fill ) ' class='$ (
7
7
$this.PathClass -join ' '
8
- ) ' $ (
8
+ ) ' transform-origin='50% 50%' $ (
9
9
foreach ($pathAttributeName in $this.PathAttribute.Keys ) {
10
10
" $pathAttributeName ='$ ( $this.PathAttribute [$pathAttributeName ]) '"
11
11
}
12
- ) />"
12
+ ) >"
13
+ if ($this.PathAnimation ) {$this.PathAnimation }
14
+ " </path>"
13
15
) -as [xml ]
Original file line number Diff line number Diff line change
1
+ param (
2
+ [PSObject ]
3
+ $PathAnimation
4
+ )
5
+
6
+ $newAnimation = @ (foreach ($animation in $PathAnimation ) {
7
+ if ($animation -is [Collections.IDictionary ]) {
8
+ $animationCopy = [Ordered ]@ {} + $animation
9
+ if (-not $animationCopy [' attributeType' ]) {
10
+ $animationCopy [' attributeType' ] = ' XML'
11
+ }
12
+ if (-not $animationCopy [' attributeName' ]) {
13
+ $animationCopy [' attributeName' ] = ' transform'
14
+ }
15
+ if ($animationCopy.values -is [object []]) {
16
+ $animationCopy [' values' ] = $animationCopy [' values' ] -join ' ;'
17
+ }
18
+
19
+ $elementName = ' animate'
20
+ if ($animationCopy [' attributeName' ] -eq ' transform' ) {
21
+ $elementName = ' animateTransform'
22
+ }
23
+
24
+ " <$elementName $ (
25
+ @ (foreach ($key in $animationCopy.Keys ) {
26
+ " $key ='$ ( [Web.HttpUtility ]::HtmlAttributeEncode($animationCopy [$key ])) '"
27
+ }) -join ' '
28
+ ) />"
29
+ }
30
+ if ($animation -is [string ]) {
31
+ $animation
32
+ }
33
+ })
34
+
35
+ $this | Add-Member - MemberType NoteProperty - Force - Name ' .PathAnimation' - Value $newAnimation
You can’t perform that action at this time.
0 commit comments