// Welcome to the Shim playground!
// Edit this code and press the play button (or Ctrl+Enter) to run it.
// While it's looping, Ctrl+Enter hot reloads your edits without
// restarting: `frame` below keeps counting from where it was.
let W = 48
let H = 32
let frame = 0
set_canvas(W, H, scale=4)
fn draw() {
let pixels = []
for row in 0..H {
for col in 0..W {
let r = ((col + frame) % W) * 255 / W
let b = row * 255 / H
pixels.append((r.round(), 80, b.round()))
}
}
draw_rect(0, 0, W, H, texture=create_texture(W, H, pixels))
}
draw()
// `loop` runs once per animation frame after the script finishes.
fn loop() {
frame = frame + 1
draw()
}Press the play button to execute