OP.turtle.ps1

#requires -Module Turtle
param(
[double]
$Size = 1080,

[string[]]
$Variants = @(
    ''
    'Text'
    'Animated'
    'Animated-Text'
    'Gradient'
    'Gradient-Text'
    'Animated-Gradient'
    'Animated-Gradient-Text' 
    'Blue'
    'Blue-Text'
    'Animated-Blue'
    'Animated-Blue-Text'
),

[string[]]
$PngVariants = @(
    ''
    'Text'
    'Blue-Text'
    'Gradient-Text'
),

[string]
$Destination = './Assets'
)


$halfSize = $size / 2

if ($psScriptRoot) {
    Push-Location $PSScriptRoot
}

if (-not (Test-Path $Destination)) {
    $null = New-Item -ItemType Directory -Path $Destination
}


foreach ($variant in $variants) {
    $fileName = "OP-$variant" -replace '-$'

    $Logo = 
        🐢 id $fileName title $fileName Arcygon $size $halfSize 4 StrokeWidth '1%'
    
    if ($variant -match 'Animated') {
        $logo = $logo | 🐢 duration '00:00:42' morph @(
            🐢 @('circleArc', $halfSize, 90, 'forward', $size, 'rotate',90 * 4)
            🐢 @('circleArc', $halfSize, -90, 'forward', $size, 'rotate',90 * 4)
            🐢 @('circleArc', $halfSize, 90, 'forward', $size, 'rotate',90 * 4)
        )
    }

    if ($variant -match 'Text') {
        $logo = $logo |
            🐢 turtles @(
                🐢 viewbox $halfSize text OP FontSize ($size/4) FontFamily 'sans-serif' @(
                    if ($variant -match 'Text') {
                        'stroke', '#4488ff'
                    }
                    elseif ($variant -match 'Gradient') {
                        'stroke', '#224488', '#4488ff', '#224488'
                    }
                )
            )
    }

    if ($variant -match 'Blue') {
        $logo.Stroke = '#4488ff'
    }

    if ($variant -match 'Gradient') {
        $logo.Stroke = '#224488', '#4488ff', '#224488'        
    }


    $fileName = "OP-$variant" -replace '-$'
    
    $logo | Save-Turtle -FilePath (
        Join-Path $destination "./$fileName.svg"
    )

    if ($pngVariants -contains $variant) {
        $logo | Save-Turtle -FilePath (
            Join-Path $destination "./$fileName.png"
        )
    }
}

return