-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathPipeScript.PSSVG.ps1
More file actions
142 lines (121 loc) · 6.21 KB
/
PipeScript.PSSVG.ps1
File metadata and controls
142 lines (121 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#requires -Module PSSVG
$RotateEvery = [Timespan]'00:00:15'
$Variants = '', '4-chevron','ouroboros','animated','4-chevron-animated','ouroboros-animated'
$ϕ = (1 + [math]::sqrt(5))/2
foreach ($variant in $variants) {
svg -ViewBox 1920,1080 @(
svg.defs @(
SVG.GoogleFont -FontName "Roboto"
SVG.marker -id 'Head' -ViewBox 100,100 @(
svg.polygon -Points (@(
"30,0"
"35,0"
"60,50"
"15,100"
"12.5,100"
"55,50"
) -join ' ') -Fill '#4488ff' -Class 'foreground-fill'
) -MarkerWidth 75 -MarkerHeight 75 -RefX 50 -RefY 50 -Orient 'auto-start-reverse'
SVG.marker -id 'Tail' -ViewBox 100,100 @(
svg.polygon -Points (@(
"30,0"
"35,0"
"60,50"
"15,100"
"12.5,100"
"55,50"
) -join ' ') -Fill '#4488ff' -Class 'foreground-fill'
) -MarkerWidth (75/$ϕ) -MarkerHeight (75/$ϕ) -RefX 50 -RefY 50 -Orient 'auto-start-reverse'
)
# $psChevron.svg.symbol.OuterXml
svg.text -FontSize 192 -TextAnchor 'middle' -DominantBaseline 'middle' -X 50% -Y 50% -Content @(
SVG.tspan -Content "P" -FontSize .9em
SVG.tspan -Content "|" -FontSize .6em -Dx -.4em
SVG.tspan -Content "peScr" -FontSize 1em -Dx -.25em
SVG.tspan -Content "|" -FontSize .6em -Dx -.4em
SVG.tspan -Content "pt" -FontSize .9em -Dx -.25em
) -Style 'font-family: "Roboto", sans-serif' -Fill '#4488ff' -Class 'foreground-fill'
if ($variant -match 'ouroboros') {
$numberOfCircles = 1..6
$RotateEvery = [timespan]'00:01:00'
} else {
$numberOfCircles = 0..2
$RotateEvery = [timespan]'00:00:15'
}
foreach ($circleN in $numberOfCircles) {
$radius = 475 - ($circleN * 5)
$circleTop = (1920/2), ((1080/2)-$radius)
$circleMid = (1920/2), (1080/2)
$circleRight = ((1920/2) + $radius),((1080/2))
$circleBottom = (1920/2), ((1080/2)+$radius)
$circleLeft = ((1920/2) - $radius),((1080/2))
$rotateEach =
if ($variant -match 'ouroboros') {
$RotateEvery / ($circleN)
} else {
$RotateEvery * (1 + $circleN)
}
if ($circleN) {
if ($variant -in '', '4-chevron') {
continue
}
}
$strokeWidth = 1.25 - ($circleN * .05)
$Opacity = 1 - ($circleN * .05)
$pathParameters = [Ordered]@{
Sweep = $true
Stroke = '#4488ff'
'Class' = 'foreground-stroke'
'fill' = 'transparent'
'markerEnd' = "url(#Head)"
strokeWidth = $strokeWidth
Opacity = $Opacity
}
SVG.ArcPath -Start $circleLeft -End $circleBottom -Sweep -Radius $radius -Large |
SVG.ArcPath -Radius $radius -End $circleLeft @pathParameters -Content @(
if ($variant -match 'animated') {
svg.animateTransform -AttributeName transform -From "0 $circleMid" -To "360 $circleMid" -dur "$($rotateEach.TotalSeconds)s" -RepeatCount 'indefinite' -AttributeType 'XML' -Type 'rotate'
}
)
SVG.ArcPath -Start $circleRight -End $circleTop -Sweep -Radius $radius -Large -Opacity $Opacity |
SVG.ArcPath -Radius $radius -End $circleRight @pathParameters -Content @(
if ($variant -match 'animated') {
svg.animateTransform -AttributeName transform -From "0 $circleMid" -To "360 $circleMid" -dur "$($rotateEach.TotalSeconds)s" -RepeatCount 'indefinite' -AttributeType 'XML' -Type 'rotate'
}
)
if ($variant -match 'ouroboros') {
$AntiPathParameters = [Ordered]@{} + $pathParameters
$AntiPathParameters.Remove('MarkerEnd')
$AntiPathParameters.MarkerStart = "url(#Tail)"
SVG.ArcPath -Start $circleLeft -End $circleBottom -Sweep -Radius $radius -Large |
SVG.ArcPath -Radius $radius -End $circleLeft @AntiPathParameters -Content @(
if ($variant -match 'animated') {
svg.animateTransform -AttributeName transform -From "360 $circleMid" -To "0 $circleMid" -dur "$($rotateEach.TotalSeconds)s" -RepeatCount 'indefinite' -AttributeType 'XML' -Type 'rotate'
}
)
SVG.ArcPath -Start $circleRight -End $circleTop -Sweep -Radius $radius -Large -Opacity $Opacity |
SVG.ArcPath -Radius $radius -End $circleRight @AntiPathParameters -Content @(
if ($variant -match 'animated') {
svg.animateTransform -AttributeName transform -From "360 $circleMid" -To "0 $circleMid" -dur "$($rotateEach.TotalSeconds)s" -RepeatCount 'indefinite' -AttributeType 'XML' -Type 'rotate'
}
)
}
if ($variant -match '4-chevron') {
SVG.ArcPath -Start $circleTop -End $circleLeft -Sweep -Radius $radius -Large -Opacity $Opacity |
SVG.ArcPath -Radius $radius -End $circleTop @pathParameters -Content @(
if ($variant -match 'animated') {
svg.animateTransform -AttributeName transform -From "0 $circleMid" -To "360 $circleMid" -dur "$($rotateEach.TotalSeconds)s" -RepeatCount 'indefinite' -AttributeType 'XML' -Type 'rotate'
}
) -Opacity $Opacity
SVG.ArcPath -Start $circleBottom -End $circleRight -Sweep -Radius $radius -Large |
SVG.ArcPath -Radius $radius -End $circleBottom @pathParameters -Content @(
if ($variant -match 'animated') {
svg.animateTransform -AttributeName transform -From "0 $circleMid" -To "360 $circleMid" -dur "$($rotateEach.TotalSeconds)s" -RepeatCount 'indefinite' -AttributeType 'XML' -Type 'rotate'
}
)
}
}
) -OutputPath (
Join-Path ($PSScriptRoot | Split-Path) Assets | Join-Path -ChildPath "PipeScript$(if ($variant) { "-$Variant"}).svg"
)
}