Peripheral drift illusion: Difference between revisions

Content added Content deleted
m (Ada: Comment)
m (syntax highlighting fixup automation)
Line 12: Line 12:


=={{header|Action!}}==
=={{header|Action!}}==
<lang Action!>PROC DrawTile(INT x BYTE y,flip,c1,c2)
<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</lang>
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}}
<lang Ada>with PDF_Out; use PDF_Out;
<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;</lang>
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].
<lang julia>using Gtk, Colors, Cairo
<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.]


<lang Nim>import gintro/[glib, gobject, gtk, gio, cairo]
<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()</lang>
discard app.run()</syntaxhighlight>


=={{header|Perl}}==
=={{header|Perl}}==
<lang perl>use strict;
<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;</lang>
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].
<!--<lang Phix>(phixonline)-->
<!--<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>
<!--</lang>-->
<!--</syntaxhighlight>-->


=={{header|Raku}}==
=={{header|Raku}}==
<lang perl6>use SVG;
<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,
]
]
)</lang>
)</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]
<lang ecmascript>import "dome" for Window
<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()</lang>
var Game = PeripheralDrift.new()</syntaxhighlight>