info = { type = "image", title = "Autumn", category = "nature", author = "BRRRO", version = "1.0", license = "MIT", desc = "Leaves fall over an autumn hill", api = 33, } local LC = { {224,90,50}, {240,150,40}, {210,170,60}, {200,80,40} } local HILL, BG function render() local W, H, FPS = gfx.W, gfx.H, gfx.FPS local t = frame / FPS local px, rect, floor = gfx.px, gfx.rect, math.floor if not HILL then local hs = {} for x = 0, W - 1 do hs[x] = 54 - floor(3 * math.abs(math.sin(x * 0.12)) + 0.5) end HILL = {} local x0 = 0 for x = 1, W do if x == W or hs[x] ~= hs[x0] then HILL[#HILL + 1] = { x0, hs[x0], x - x0 } x0 = x end end end if not BG then for y = 0, H - 1 do local f = y / H rect(0, y, W, 1, 255, 200 + 28 * f, 140 + 40 * f) end for i = 1, #HILL do local S = HILL[i] rect(S[1], S[2], S[3], H - S[2], 180, 120, 60) end BG = gfx.snapshot(0, 0, W, H) else gfx.blit_rgb(BG, 0, 0, W, H) end for i = 0, 15 do local y = ((i * 43 + t * 42) % (H + 8)) // 1 - 4 if y >= 0 and y < H then local x = (i * 41 + 9 + floor(8 * math.sin(t * 2.4 + i) + 0.5)) % W local c = LC[i % 4 + 1] px(x, y, c[1], c[2], c[3]) px(x + 1, y, c[1], c[2], c[3]) px(x, y + 1, c[1], c[2], c[3]) end end end