Peripheral drift illusion: Difference between revisions
Content added Content deleted
m (Ada: Comment) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 12: | Line 12: | ||
=={{header|Action!}}== |
=={{header|Action!}}== |
||
< |
<syntaxhighlight lang="action!">PROC DrawTile(INT x BYTE y,flip,c1,c2) |
||
BYTE i |
BYTE i |
||
Line 78: | Line 78: | ||
DO UNTIL CH#$FF OD |
DO UNTIL CH#$FF OD |
||
CH=$FF |
CH=$FF |
||
RETURN</ |
RETURN</syntaxhighlight> |
||
{{out}} |
{{out}} |
||
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Peripheral_drift_illusion.png Screenshot from Atari 8-bit computer] |
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Peripheral_drift_illusion.png Screenshot from Atari 8-bit computer] |
||
Line 85: | Line 85: | ||
{{trans|Wren}} |
{{trans|Wren}} |
||
{{libheader|APDF}} |
{{libheader|APDF}} |
||
< |
<syntaxhighlight lang="ada">with PDF_Out; use PDF_Out; |
||
procedure Drift is |
procedure Drift is |
||
Line 184: | Line 184: | ||
Draw_Squares; |
Draw_Squares; |
||
PDF.Close; |
PDF.Close; |
||
end Drift;</ |
end Drift;</syntaxhighlight> |
||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
Line color tables taken from the Wren example. See the output [https://imgur.com/jKqIgbe on imgur]. |
Line color tables taken from the Wren example. See the output [https://imgur.com/jKqIgbe on imgur]. |
||
< |
<syntaxhighlight lang="julia">using Gtk, Colors, Cairo |
||
function CodepenApp() |
function CodepenApp() |
||
Line 250: | Line 250: | ||
CodepenApp() |
CodepenApp() |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |
||
Line 259: | Line 259: | ||
See window screenshot [https://github.com/lscrd/Rosetta/blob/main/Images/Peripheral_drift_illusion-Nim.png here.] |
See window screenshot [https://github.com/lscrd/Rosetta/blob/main/Images/Peripheral_drift_illusion-Nim.png here.] |
||
< |
<syntaxhighlight lang="nim">import gintro/[glib, gobject, gtk, gio, cairo] |
||
const |
const |
||
Line 353: | Line 353: | ||
let app = newApplication(Application, "Rosetta.Illusion") |
let app = newApplication(Application, "Rosetta.Illusion") |
||
discard app.connect("activate", activate) |
discard app.connect("activate", activate) |
||
discard app.run()</ |
discard app.run()</syntaxhighlight> |
||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
< |
<syntaxhighlight lang="perl">use strict; |
||
use warnings; |
use warnings; |
||
Line 386: | Line 386: | ||
open my $fh, '>', 'peripheral-drift.svg'; |
open my $fh, '>', 'peripheral-drift.svg'; |
||
print $fh $svg; |
print $fh $svg; |
||
close $fh;</ |
close $fh;</syntaxhighlight> |
||
See [https://github.com/SqrtNegInf/Rosettacode-Perl5-Smoke/blob/master/ref/peripheral-drift.svg offsite SVG image] |
See [https://github.com/SqrtNegInf/Rosettacode-Perl5-Smoke/blob/master/ref/peripheral-drift.svg offsite SVG image] |
||
Line 392: | Line 392: | ||
{{libheader|Phix/online}} |
{{libheader|Phix/online}} |
||
You can run this online [http://phix.x10.mx/p2js/Peripheral_Drift_Illusion.htm here]. |
You can run this online [http://phix.x10.mx/p2js/Peripheral_Drift_Illusion.htm here]. |
||
<!--< |
<!--<syntaxhighlight lang="phix">(phixonline)--> |
||
<span style="color: #000080;font-style:italic;">-- |
<span style="color: #000080;font-style:italic;">-- |
||
-- demo\rosetta\Peripheral_Drift_Illusion.exw |
-- demo\rosetta\Peripheral_Drift_Illusion.exw |
||
Line 475: | Line 475: | ||
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span> |
<span style="color: #008080;">end</span> <span style="color: #008080;">procedure</span> |
||
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span> |
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span> |
||
<!--</ |
<!--</syntaxhighlight>--> |
||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
<lang |
<syntaxhighlight lang="raku" line>use SVG; |
||
my @blocks = (1..15 X 1..10).map: -> ($X, $Y) { |
my @blocks = (1..15 X 1..10).map: -> ($X, $Y) { |
||
Line 501: | Line 501: | ||
|@blocks, |
|@blocks, |
||
] |
] |
||
)</ |
)</syntaxhighlight> |
||
See [https://github.com/thundergnat/rc/blob/master/img/peripheral-drift-raku.svg offsite SVG image] |
See [https://github.com/thundergnat/rc/blob/master/img/peripheral-drift-raku.svg offsite SVG image] |
||
Line 508: | Line 508: | ||
This reproduces the codepen image and does indeed appear to move although it's static. |
This reproduces the codepen image and does indeed appear to move although it's static. |
||
See the output [https://imgur.com/xyVcnif on imgur] |
See the output [https://imgur.com/xyVcnif on imgur] |
||
< |
<syntaxhighlight lang="ecmascript">import "dome" for Window |
||
import "graphics" for Canvas, Color |
import "graphics" for Canvas, Color |
||
Line 577: | Line 577: | ||
} |
} |
||
var Game = PeripheralDrift.new()</ |
var Game = PeripheralDrift.new()</syntaxhighlight> |