Lingual Fractals #349
StartAutomating
started this conversation in
Show and tell
Replies: 1 comment
-
|
Here's another example. This one uses just Note: must save this to a script file an execute #requires -Module Turtle
param(
[string]
$Message,
[double]
$Scale = 10
)
if (-not $Message) {
$Message = "$($MyInvocation.MyCommand.ScriptBlock)"
}
if ($PSScriptRoot) { Push-Location $PSScriptRoot }
$myName = $MyInvocation.MyCommand.Name -replace '\.ps1$' -replace '\.turtle$'
$turtleArgs = @()
$morphToArgs = @()
$words = @($Message -split '[\s\p{P}]+')
for ($wordNumber = 0; $wordNumber -lt $words.Length; $wordNumber++) {
$word = $words[$wordNumber]
$nextWord = $words[$wordNumber + 1]
$turtleArgs += @(
'forward', ($word.Length * $scale)
'square', ($word.Length * $Scale)
'rotate', 90
)
$morphToArgs += @(
'rotate', (
($word.Length % 4) * 90
)
'forward', ($word.Length * $scale)
'square', ($word.Length * $scale)
'rotate', 90
)
}
$colors = @('#4488ff','#224488', '#012456')
$style = @(
'fillrule', 'evenodd', 'fill', @($colors | Get-Random -count 2), 'stroke', @($colors | Get-Random -count 2)
)
if ($Message -ne "$($MyInvocation.MyCommand.ScriptBlock)") {
$MyName += $Message -replace '[\W]'
if ($myName.Length -gt 100) {
$myName = $myName.Substring(0, 100)
}
}
turtle @style @turtleArgs Morph @(
turtle @turtleArgs
turtle @morphToArgs
turtle @turtleArgs
) save "./${myName}Morph.svg" patterntransform @{
scale = 0.5
} save "./${myName}MorphPattern.svg"
turtle @style @turtleArgs patterntransform @{
scale = 0.5
} PatternAnimation ([Ordered]@{
type = 'scale' ; values = 0.66,0.33, 0.66 ; repeatCount = 'indefinite' ;dur = "211s"; additive = 'sum'
}, [Ordered]@{
type = 'rotate' ; values = 0, 360 ;repeatCount = 'indefinite'; dur = "421s"; additive = 'sum'
}, [Ordered]@{
type = 'skewX' ; values = -30,30,-30;repeatCount = 'indefinite';dur = "521s";additive = 'sum'
}, [Ordered]@{
type = 'skewY' ; values = 30,-30, 30;repeatCount = 'indefinite';additive = 'sum';dur = "397s"
}, [Ordered]@{
type = 'translate';values = "0 0","433 421", "0 0";repeatCount = 'indefinite';additive = 'sum';dur = "239s"
}
) save "./${myName}EndlessPattern.svg"
turtle @style @turtleArgs save "./${myName}.svg" save "./${myName}.png"
if ($PSScriptRoot) { Pop-Location } |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
We can turn any message into #TurtleGraphics to make #LingualFractals
#PowerShell #Fractal #MathArt #Stenography #SVG #WebDev #Turtle #TurtlePower
Learn more and share yours:
Example
Source
Source:
Beta Was this translation helpful? Give feedback.
All reactions