157e Tile Shadow
(meta linear-colour-space: 1)
(rect position: [(/ canvas/width 2) (/ canvas/height 2)]
width: canvas/width
height: canvas/height
colour: white ~ (gen/col))
(loop (y from: 1 to: (- num-squares 1))
(loop (x from: 1 to: (- num-squares 1))
(define
position [(map-to-position at: x) (map-to-position at: y)]
[px py] position
colour (col/value from: make-colour
t: (focal/value from: focalpoint position: position)))
(draw-tile position: [(+ px 5) (- py 5)]
colour: (col/set-e2 from: (col/convert from: colour format: LAB)
value: 50))
(draw-tile position: position
colour: colour)))
(define make-colour
(col/build-procedural a: [0.80 0.50 0.40] ~ (gen/scalar)
b: [0.20 0.40 0.20] ~ (gen/scalar)
c: [2.00 1.00 1.00] ~ (gen/scalar)
d: [0.00 0.25 0.25] ~ (gen/scalar)))
(define
focalpoint (focal/build-point ~ (gen/select from: '(focal/build-point focal/build-hline focal/build-vline))
position: [500 ~ (gen/int max: canvas/width)
500 ~ (gen/int max: canvas/height)]
distance: 800 ~ (gen/int min: (/ canvas/width 2) max: canvas/width))
num-squares-to-render 7 ~ (gen/int min: 4 max: 10)
num-squares (+ 2 num-squares-to-render)
num-gaps (+ num-squares 1)
square-size (/ canvas/width num-squares))
(fn (draw-tile position: [0 0]
colour: red)
(on-matrix-stack
(translate vector: position)
(rotate angle: 45)
(scale scalar: 1.3)
(rect position: [0 0]
width: square-size
height: square-size
colour: colour)))
(fn (map-to-position at: 0)
(+ (* square-size at) (/ square-size 2)))