info = { type = "image", title = "Starfield", category = "space", author = "BRRRO", version = "1.0", license = "MIT", desc = "Stars fly out from the centre", api = 33, } local N = 44 local COS, SIN, SPD = {}, {}, {} for i = 0, N - 1 do local a = ((i * 97) % 360) * math.pi / 180 COS[i], SIN[i] = math.cos(a), math.sin(a) SPD[i] = 18 + (i % 5) * 7.2 end local BG function render() local W, H = gfx.W, gfx.H local t = frame / gfx.FPS 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, 18 + 22 * f, 20 + 24 * f, 46 + 38 * f) end BG = gfx.snapshot(0, 0, W, H) end local cx, cy = W // 2, H // 2 - 2 for i = 0, N - 1 do local dist = (t * SPD[i] + i * 7) % 36 local x, y = math.floor(cx + COS[i] * dist), math.floor(cy + SIN[i] * dist) if x >= 0 and x < W and y >= 0 and y < H then local br = 70 + dist * 7 if br > 255 then br = 255 end gfx.px(x, y, br, br, br) if dist > 14 then local x2 = math.floor(cx + COS[i] * (dist - 1.5)) local y2 = math.floor(cy + SIN[i] * (dist - 1.5)) if x2 >= 0 and x2 < W and y2 >= 0 and y2 < H then gfx.px(x2, y2, br * 0.55, br * 0.55, br * 0.65) end end end end end