Peripheral drift illusion: Difference between revisions
Content added Content deleted
(Added missing closing tag.) |
Thundergnat (talk | contribs) (→{{header|Raku}}: Add a Raku example) |
||
Line 265: | Line 265: | ||
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span> |
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span> |
||
<!--</lang>--> |
<!--</lang>--> |
||
=={{header|Raku}}== |
|||
<lang perl6>use SVG; |
|||
my @blocks = (1..15 X 1..10).map: -> ($X, $Y) { |
|||
my $r = (($X + $Y) div 2) % 4 * 90; |
|||
my $x = $X * 75; |
|||
my $y = $Y * 75; |
|||
:use[ 'xlink:href' => '#block', 'transform' => "rotate($r,$x,$y) translate($x,$y)" ] |
|||
} |
|||
'peripheral-drift-raku.svg'.IO.spurt: SVG.serialize( |
|||
svg => [ |
|||
:1200width, :825height, |
|||
:rect[:width<100%>, :height<100%>, :fill<#d3d004>], |
|||
:defs[ |
|||
:g[ |
|||
:id<block>, |
|||
:polygon[ :points<-25,-25,-25,25,25,25>, :style< fill:white;stroke:white>], |
|||
:polygon[ :points<25,25,25,-25,-25,-25>, :style< fill:black;stroke:black>], |
|||
:rect[:x<-20>, :y<-20>, :width<40>, :height<40>, :fill<#3250ff>] |
|||
] |
|||
], |
|||
|@blocks, |
|||
] |
|||
)</lang> |
|||
See [https://github.com/thundergnat/rc/blob/master/img/peripheral-drift-raku.svg offsite SVG image] |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |