Jump to content

Peripheral drift illusion: Difference between revisions

docs
m (julia example)
(docs)
Line 11:
=={{header|Julia}}==
Line color tables taken from the Wren example.
<lang julia>usingjuliausing Gtk, Colors, Cairo
 
function CodepenApp()
# left-top, top-right, right-bottom, bottom-left
# signifies the white edges on the blue squares
LT, TR, RB, BL = 1, 2, 3, 4
edges = [
Line 35:
[B, W, W, B],
[B, B, W, W]]
win = GtkWindow("Peripheral drift illusion", 230, 230) |> (can = GtkCanvas())
 
win = GtkWindow("Peripheral drift illusion", 230, 230)
can = GtkCanvas()
push!(win, can)
set_gtk_property!(can, :expand, true)
 
@guarded draw(can) do widget
ctx = Gtk.getgc(can)
Line 52 ⟶ 47:
rectangle(ctx, 0, 0, 250, 250)
fill(ctx)
set_line_width(ctx, 2)
for x in 1:12
px = 18 + x * 14
Line 60 ⟶ 56:
fill(ctx)
carray = colors[edges[y][x]]
set_line_width(ctx, 2)
line(px, py, px + 9, py, carray[1])
line(px + 9, py, px + 9, py + 9, carray[2])
Line 79 ⟶ 74:
CodepenApp()
</lang>
 
 
=={{header|Phix}}==
4,107

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.