info = { type = "image", title = "Stars", category = "space", author = "BRRRO", version = "1.0", license = "MIT", desc = "Night sky with a constellation", api = 33, } local CS = { {14,16}, {24,10}, {34,18}, {44,12}, {50,24}, {40,30}, {28,26} } local LX, LY local BG function render() local W, H = gfx.W, gfx.H local t = frame / gfx.FPS local px, floor, sin = gfx.px, math.floor, math.sin if not LX then LX, LY = {}, {} local n = 0 for i = 2, 7 do local a, b = CS[i - 1], CS[i] local dx, dy = b[1] - a[1], b[2] - a[2] local steps = math.ceil(math.sqrt(dx * dx + dy * dy)) for k = 0, steps do n = n + 1 LX[n] = floor(a[1] + dx * k / steps + 0.5) LY[n] = floor(a[2] + dy * k / steps + 0.5) end end end 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, 24 + 20 * f, 28 + 22 * f, 64 + 28 * f) end BG = gfx.snapshot(0, 0, W, H) end for i = 0, 49 do if sin(t * 4.8 + i) > 0 then px((i * 47 + 11) % W, (i * 31 + 5) % H, 200, 210, 240) end end for i = 1, #LX do px(LX[i], LY[i], 112, 132, 192) end for p = 1, 7 do local c = CS[p] gfx.rect(c[1] - 1, c[2] - 1, 3, 3, 255, 244, 180) px(c[1], c[2], 255, 255, 255) end end