info = { type = "image", title = "Desert", category = "nature", author = "BRRRO", version = "1.0", license = "MIT", desc = "Pyramids, dunes and the desert sun", api = 33, } local PYR = { 14, 15, 30, 21, 45, 13 } local DUNE = { { 6, 49, 4, 232, 186, 118 }, { 14.4, 56, 5, 206, 158, 92 }, } local BG function render() local W, H, FPS = gfx.W, gfx.H, gfx.FPS local t = frame / FPS local floor, sin = math.floor, math.sin if BG then gfx.blit_rgb(BG, 0, 0, W, H) else for y = 0, H - 1 do local f = y / H gfx.rect(0, y, W, 1, 255, 202 + 32 * f, 148 + 50 * f) end for yy = 7, 17 do local dy = yy - 12 local hw = floor(math.sqrt(34 - dy * dy)) gfx.rect(48 - hw, yy, 2 * hw + 1, 1, 255, 240, 176) end for p = 1, 5, 2 do local cx, h = PYR[p], PYR[p + 1] for r = 0, h - 1 do local w = h - 1 - r gfx.rect(cx - w, 42 - r, 2 * w + 1, 1, 202, 158, 98) end end BG = gfx.snapshot(0, 0, W, H) end for l = 1, 2 do local D = DUNE[l] local off, base, amp = t * D[1], D[2], D[3] local x0, hp = 0, nil for x = 0, W do local h if x < W then h = base - floor(amp * sin((x + off) * 0.05) + 0.5) end if h ~= hp then if hp then gfx.rect(x0, hp, x - x0, H - hp, D[4], D[5], D[6]) end x0, hp = x, h end end end end