Add index.html with basic documentation

This commit is contained in:
arne 2025-10-06 21:01:12 +02:00
commit 3a78fec456
5 changed files with 173 additions and 10 deletions

55
assets/scripts/boot.lua Normal file
View file

@ -0,0 +1,55 @@
local math = require('math')
local paper = require('paper')
paper.init()
paper.set_rotation("portrait")
paper.clear()
local width = paper.get_width()
local height = paper.get_height()
print(
'width: ' .. width,
'height: ' .. height
)
-- easing functions taken from https://easings.net/
function ease_in_sine(x)
return 1 - math.cos(x * math.pi / 2)
end
function ease_in_out_sine(x)
return -(math.cos(math.pi * x) - 1) / 2
end
--
-- actual sketch follows below
--
local x = width / 2
local max_radius = 128
local min_radius = max_radius / 6
local padding = max_radius
local max_color = 0xDD
local min_color = 0x33
local steps = 72
-- background
paper.fill_rect(0, 0, width, height, 0x22)
-- sketch
for i = 1, steps do
local n = i / steps
local e1 = ease_in_sine(n)
local e2 = 1 - ease_in_out_sine(ease_in_sine(n))
local color = math.floor(max_color - (max_color - min_color) * e2)
paper.fill_circle(
x + math.sin((math.pi * 2) / n) * 32 * e1,
padding + (height - max_radius - padding * 2) * e1,
min_radius + (max_radius - min_radius) * e1,
color
)
end
paper.update()

View file

@ -0,0 +1,33 @@
local math = require('math')
local paper = require('paper')
paper.init()
paper.set_rotation("portrait")
paper.clear()
local width = paper.get_width()
local height = paper.get_height()
print(
'width: ' .. width,
'height: ' .. height
)
paper.clear()
paper.fill_rect(0, 0, width, height, 0x22)
for i = 0, 4 do
local off = 40 * i
local color
if i % 2 == 0 then
color = 0x22
else
color = 0xDD
end
paper.fill_rect(off, off, width - off, height - off, color)
end
paper.update()