info = { type = "image", title = "Moon", category = "space", author = "BRRRO", version = "1.0", license = "MIT", desc = "A rocket arcs towards the moon", api = 33, } local MX, MY = 50, 13 local HALF7, HALF6 = {}, {} for yy = -7, 7 do HALF7[yy] = math.floor(math.sqrt(49 - yy * yy)) end for yy = -6, 6 do HALF6[yy] = math.floor(math.sqrt(36 - yy * yy)) end local N = 22 local SX, SY = nil, nil local BG function render() local W, H = gfx.W, gfx.H local t = frame / gfx.FPS local rect, px, sin = gfx.rect, gfx.px, math.sin if not SX then SX, SY = {}, {} for i = 0, N - 1 do SX[i], SY[i] = (i * 43 + 11) % W, (i * 29 + 5) % 40 end end if BG then gfx.blit_rgb(BG, 0, 0, W, H) else for y = 0, H - 1 do local f = y / H rect(0, y, W, 1, 150 + 60 * f, 170 + 50 * f, 222 + 18 * f) end BG = gfx.snapshot(0, 0, W, H) end local ph = t * 4.8 for i = 0, N - 1 do if sin(ph + i) > 0.2 then px(SX[i], SY[i], 255, 255, 242) end end for yy = -7, 7 do local h = HALF7[yy] rect(MX - h, MY + yy, 2 * h + 1, 1, 214, 220, 206) end for yy = -6, 6 do local h = HALF6[yy] rect(MX - h, MY + yy, 2 * h + 1, 1, 238, 240, 224) end px(MX - 2, MY - 1, 206, 212, 196) px(MX + 2, MY + 2, 206, 212, 196) px(MX, MY + 3, 206, 212, 196) local p = (t * 0.36) % 1 for k = 1, 4 do local tp = p - k * 0.03 if tp < 0 then tp = 0 end local fx = math.floor(4 + tp * 42 + 0.5) local fy = math.floor(60 - tp * 42 - sin(tp * math.pi) * 8 + 0.5) if k < 2 then px(fx, fy + 1, 255, 180, 80) else px(fx, fy + 1, 255, 150, 60) end end local rx = math.floor(4 + p * 42 + 0.5) local ry = math.floor(60 - p * 42 - sin(p * math.pi) * 8 + 0.5) px(rx, ry - 1, 255, 120, 80) px(rx - 1, ry, 200, 210, 224) px(rx, ry, 240, 244, 250) px(rx + 1, ry, 200, 210, 224) px(rx, ry + 1, 255, 200, 90) end