info = { type = "app", title = "Images", author = "BRRRO", license = "MIT", desc = "Cycles through your images", category = "ambient", api = 38, } permissions = { "images" } txt = ({ sk = { add1 = "ZVOĽ", add2 = "OBRÁZKY" }, cs = { add1 = "VYBER", add2 = "OBRÁZKY" } })[lang] or { add1 = "SELECT", add2 = "IMAGES" } local GOLD = { 198, 150, 60 } local MAT = { 18, 18, 34 } local FX, FY, FW, FH = 12, 7, 40, 30 local PX, PY, PW, PH = FX + 2, FY + 2, FW - 4, FH - 4 local HOLD_S, SLIDE_S = 2.3, 0.7 local abs, floor = math.abs, math.floor local function band(y, h, r, g, b) gfx.rect(PX, PY + y, PW, h, r, g, b) end local function hill(peak, h, d, r, g, b) for x = 0, PW - 1 do local v = h - abs(x - peak) // d if v > 0 then gfx.rect(PX + x, PY + PH - v, 1, v, r, g, b) end end end local function disc(cx, cy, rows, r, g, b) for i, w in ipairs(rows) do gfx.rect(PX + cx - w // 2, PY + cy + i - 1, w, 1, r, g, b) end end local SCENES = { function() band(0, 5, 70, 40, 120) band(5, 4, 150, 60, 120) band(9, 4, 230, 105, 80) band(13, 3, 255, 165, 85) disc(17, 11, { 5, 7, 9, 9, 11 }, 255, 225, 140) gfx.rect(PX, PY + 14, 7, 2, 60, 30, 80) gfx.rect(PX, PY + 13, 4, 1, 60, 30, 80) band(16, PH - 16, 40, 35, 90) for i, w in ipairs({ 9, 7, 7, 5, 3 }) do gfx.rect(PX + 17 - w // 2, PY + 15 + 2 * i, w, 1, 255, 170, 90) end end, function() band(0, 13, 8, 12, 40) band(13, PH - 13, 16, 24, 64) for _, s in ipairs({ { 3, 2 }, { 11, 6 }, { 17, 2 }, { 33, 9 }, { 7, 10 }, { 22, 7 }, { 34, 3 } }) do gfx.px(PX + s[1], PY + s[2], 200, 210, 255) end disc(28, 2, { 3, 5, 5, 5, 3 }, 230, 230, 205) disc(30, 1, { 3, 5, 5, 5, 3 }, 8, 12, 40) hill(18, 11, 2, 22, 50, 72) hill(4, 8, 1, 30, 70, 74) gfx.rect(PX + 12, PY + PH - 6, 5, 4, 70, 58, 74) disc(14, PH - 9, { 3, 5, 7 }, 110, 48, 58) gfx.rect(PX + 14, PY + PH - 5, 1, 2, 255, 200, 90) band(PH - 2, 2, 24, 56, 60) end, function() band(0, 12, 60, 120, 210) band(12, PH - 12, 100, 160, 230) disc(6, 3, { 3, 5, 5, 5, 3 }, 255, 215, 80) gfx.rect(PX + 16, PY + 3, 4, 1, 235, 240, 250) gfx.rect(PX + 14, PY + 4, 9, 2, 235, 240, 250) gfx.rect(PX + 28, PY + 8, 4, 1, 235, 240, 250) gfx.rect(PX + 27, PY + 9, 6, 1, 235, 240, 250) hill(27, 14, 1, 50, 130, 110) hill(10, 10, 1, 70, 170, 90) band(PH - 3, 3, 60, 150, 80) end, } local SHOTS, WALL = {}, nil local function build() for i, draw in ipairs(SCENES) do draw() SHOTS[i] = gfx.snapshot(PX, PY, PW, PH) end gfx.clear(13, 14, 30) gfx.rect(31, FY - 2, 2, 2, GOLD[1], GOLD[2], GOLD[3]) gfx.round_rect(FX, FY, FW, FH, MAT[1], MAT[2], MAT[3], GOLD[1], GOLD[2], GOLD[3], 2) gfx.text_center(41, txt.add1, 255, 250, 232) gfx.text_center(51, txt.add2, GOLD[1], GOLD[2], GOLD[3]) WALL = gfx.snapshot(0, 0, gfx.W, gfx.H) end local function emptyState() if not WALL then build() end gfx.blit_rgb(WALL, 0, 0, gfx.W, gfx.H) local t = frame / gfx.FPS local n = #SHOTS local i = floor(t / (HOLD_S + SLIDE_S)) % n + 1 local u = (t % (HOLD_S + SLIDE_S) - HOLD_S) / SLIDE_S gfx.clip(PX, PY, PW, PH) if u <= 0 then gfx.blit_rgb(SHOTS[i], PX, PY, PW, PH) else local off = floor(u * u * (3 - 2 * u) * PW + 0.5) gfx.blit_rgb(SHOTS[i], PX - off, PY, PW, PH) gfx.blit_rgb(SHOTS[i % n + 1], PX + PW - off, PY, PW, PH) end gfx.clip() local k = (frame % (2 * gfx.FPS)) / gfx.FPS if k > 1 then k = 2 - k end local a = 1 - 0.35 * k gfx.round_rect(PX + PW - 13, PY + PH - 13, 11, 11, MAT[1], MAT[2], MAT[3], GOLD[1], GOLD[2], GOLD[3], 2) local pr, pg, pb = floor(255 * a), floor(250 * a), floor(232 * a) gfx.rect(PX + PW - 11, PY + PH - 8, 7, 1, pr, pg, pb) gfx.rect(PX + PW - 8, PY + PH - 11, 1, 7, pr, pg, pb) end function render() if gfx.bg() then return end if #images == 0 then emptyState() else gfx.clear(0, 0, 0) end end