-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPrimeTime.svg.ps1
More file actions
88 lines (80 loc) · 2.73 KB
/
Copy pathPrimeTime.svg.ps1
File metadata and controls
88 lines (80 loc) · 2.73 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
<#
.SYNOPSIS
PrimeTime logo
.DESCRIPTION
PrimeTime logo.
Resembles the PoshWeb logo, but uses more prime numbers
.NOTES
#>
param(
[string]
$Variant = '',
[int]
$First
)
$psChevron = '<symbol id="psChevron" viewBox="0 0 100 100">
<polygon points="40,20 45,20 60,50 35,80 32.5,80 55,50"/>
</symbol>'
$stroke = @(
"stroke='#4488ff'"
"class='foreground-stroke'"
"stroke-width='0.5%'"
)
$transparentFill = "fill='transparent'"
$animationLoop = "repeatCount='indefinite'"
$centered = "cx='50%'", "cy='50%'"
$primeTimes = 4..12 | Get-PrimeTime
$primes = $primeTimes.prime
$Sequence = $primes
"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' width='100%' height='100%'>"
$psChevron
for ($index = 0; $index -lt ($sequence.Length - 1); $index++) {
$n = 50
$duration = "dur='$($primes[$primes.Length - 1 - $index])s'"
if (-not $index) {
"<circle $centered $transparentFill $stroke r='$n%' />"
}
else {
if ($variant -match 'animate') {
$values = " values='$(
"$n%", "5%", "$n%" -join ';'
)'"
}
$opacity = 1 - (.07 * $index)
"<ellipse $centered $transparentFill $stroke $(
if ($Variant -match 'animate') {
"rx='$n%' ry='$n%'"
} else {
"rx='$($sequence[$index])%' ry='$n%'"
}
) opacity='$opacity'>"
if ($variant -match 'animate') {
"<animate attributeName='rx' $animationLoop $duration $values />"
"<animate attributeName='opacity' $animationLoop $duration values='$(
$opacity,($opacity/2),$opacity -join ';'
)' />"
}
"</ellipse>"
"<ellipse $centered $transparentFill $stroke $(
if ($Variant -match 'animate') {
"rx='$n%' ry='$n%'"
} else {
"rx='$n%' ry='$($sequence[$index])%'"
}
) opacity='$opacity'>"
if ($variant -match 'animate') {
"<animate attributeName='ry' $animationLoop $duration $values />"
}
if ($variant -match 'animate') {
"<animate attributeName='opacity' $animationLoop $duration values='$(
$opacity,($opacity/2),$opacity -join ';'
)' />"
}
"</ellipse>"
}
if ($First -and ($index + 1) -gt $First) {
break
}
}
"<use href='#psChevron' y='42%' height='16%' fill='#4488ff' class='foreground-fill' />"
"</svg>"