Skip to content

Instantly share code, notes, and snippets.

@mattdesl
Created January 6, 2023 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattdesl/5d64db4c2561950bd1233adea8ef5af9 to your computer and use it in GitHub Desktop.
Save mattdesl/5d64db4c2561950bd1233adea8ef5af9 to your computer and use it in GitHub Desktop.
homage to the square in the esolang ryu, #genuary 2022, prompt: "steal like an artist"
(fn loop (n iter) (do
(var i 0)
(while (< i n) (do
(iter i)
(set i (+ 1 i))
))
))
(var colors [
"#E84420" "#F4CD00" "#3E58E2"
"#999999" "#F1892A" "#22A722" "#7F3CAC"
"#F391C7" "#995F29" "#3DC1A2" "#D5B3E5"
])
(var bg "#E9E3D5")
(canvas/fill bg)
(random/seed 31)
(var count 6)
(loop count (fn (i) (do
(var u (/ i (- count 1)))
(var sizedec (math/pow (- 1 u) 1.5))
(var size (* sizedec 0.8 width))
(var sizey (* 1.05 size))
(var sizey size)
(var yoff (* (math/pow u 5) size -4))
(var px (- (/ width 2) (/ size 2)))
(var py (- (/ width 2) (/ sizey 2) yoff))
(var offset (* i 0.025))
(var gx (random 0 (* offset size)))
(var gy (random 0 (* offset sizey)))
(set px (+ px gx))
(set py (+ py gy))
(var cidx (math/floor (random 0 (length colors))))
(var color (list/nth colors cidx))
(canvas/rect px py size sizey color)
)))
; draw output
(canvas/draw)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment