Compare commits

..

No commits in common. "8c0b2d3653481845b8f57577812f1d5e13b7366c" and "71e06141d0734d3648224a06b6709c59175e3a08" have entirely different histories.

4 changed files with 11 additions and 54 deletions

View file

@ -1,18 +1,5 @@
function love.conf(t)
t.identity = 'box-of-eases'
t.version = '11.3'
t.window.resizable = true
t.window.title = 'Box of Eases'
t.window.icon = 'logo.png'
t.window.msaa = 5
t.modules.audio = false
t.modules.data = false
t.modules.joystick = false
t.modules.math = false
t.modules.physics = false
t.modules.sound = false
t.modules.thread = false
t.modules.video = false
end

View file

@ -48,7 +48,6 @@ local function insertDropdown(tab, f)
dropdownId = dropdownId + 1
f.selected = (self.kget(f.name) or dropdownValueCache[f.name] or {selected = 1}).selected
f.selected = (f.selected - 1) % #f.options + 1
f.open = (self.kget(f.name) or {open = 0}).open
return table.insert(tab, f)
end
function self.createDropdowns()
@ -111,14 +110,6 @@ function self.update(dt)
dropdownScroll = math.min(dropdownScroll, 0)
dropdownScrollE = mix(dropdownScrollE, dropdownScroll, dt * 10)
end
for i, v in ipairs(dropdowns) do
if i == self.openDropdown then
v.open = mix(v.open, 1, dt * 14)
else
v.open = mix(v.open, 0, dt * 20)
end
end
end
function self.render()
@ -136,21 +127,21 @@ function self.render()
love.graphics.rectangle('line', x, y, w, h)
love.graphics.print(self.selected(i), x + margin/2, y + margin/2)
-- love.graphics.rectangle('line', x + w - h, y, h, h)
love.graphics.rectangle('line', x + w - h, y, h, h)
love.graphics.polygon('line', x + w - h/2 + 0.3 * h, y + h/2 - 0.3 * h, x + w - h/2 - 0.3 * h, y + h/2 - 0.3 * h, x + w - h/2, y + h/2 + 0.3 * h)
if self.openDropdown == i or v.open > 0.01 then
if self.openDropdown == i then
for i,o in ipairs(v.options) do
local x, y, w, h = x, y + ((i - 1) * v.open + 1) * h, w, h * v.open
local x, y, w, h = x, y + i * h, w, h
y = y + dropdownScrollE * h * v.open
y = y + dropdownScrollE * h
local gi = y / h
if gi > (maxDropdown + 1) or gi < 1 then
goto continue
end
-- help
local a = (1 - math.min(math.max((1 - (maxDropdown - gi)) * (1 - (math.abs(dropdownScrollE) / (#v.options - maxDropdown + 1))), 0), 1)) * math.max(math.min(gi - 1, 1), 0) * v.open
local a = (1 - math.min(math.max((1 - (maxDropdown - gi)) * (1 - (math.abs(dropdownScrollE) / (#v.options - maxDropdown + 1))), 0), 1)) * math.max(math.min(gi - 1, 1), 0)
love.graphics.setColor(0.06, 0.06, 0.12, 0.3 * a)
if mx > x and mx < x + w and my > y and my < y + h then
@ -174,8 +165,8 @@ function self.render()
local scroll = math.abs(dropdownScrollE) / (#v.options - maxDropdown + 1)
local size = margin
love.graphics.setColor(1, 1, 1, 0.9 * v.open)
love.graphics.rectangle('fill', x + w - size, y + h + scroll * (1 - displayed) * (maxDropdown - 1) * h * v.open, size, displayed * (maxDropdown - 1) * h * v.open)
love.graphics.setColor(1, 1, 1, 0.9)
love.graphics.rectangle('fill', x + w - size, y + h + scroll * (1 - displayed) * (maxDropdown - 1) * h, size, displayed * (maxDropdown - 1) * h)
end
end
end

View file

@ -3,10 +3,6 @@ local self = {}
local quality = 256
local graph = {}
self.touchtimer = 0
local timer = 0
function self.update(dt)
for i = 1, quality do
local a = (i - 1) / (quality - 1)
@ -22,22 +18,6 @@ function self.update(dt)
end
graph[i] = mix(v, b, math.min(dt * 18, 1))
end
self.touchtimer = mix(self.touchtimer, 0, dt * 2)
-- lots of math just for the timer
-- may need to abstract this out, somehow
-- todo
local sw, sh = love.graphics.getDimensions()
local csize = 10 -- preview point size
local size = math.min((sw - outerpadding) - ((dropdown.kget('ease2') or dropdown.kget('ease1')).x + dropdownWidth + padding), sh - outerpadding * 2 - padding * 3 - csize)
local x, y, w, h = sw - outerpadding - size, outerpadding, size, size
local mx, my = love.mouse.getPosition()
if not (love.mouse.isDown(1) and mx > x and mx < x + w and my > y and my < y + h) then
timer = (timer + dt) % 2
else
timer = mix(timer, (mx - x) / w, dt * 14)
end
end
function self.render()
@ -63,12 +43,12 @@ function self.render()
-- mixease point
if mode == 2 then
love.graphics.setColor(1, 1, 1, 0.2 + self.touchtimer * 0.6)
love.graphics.line(x + margin + oldmixpoint * w, y, x + margin + oldmixpoint * w, y + h)
love.graphics.setColor(1, 1, 1, 0.8)
love.graphics.line(x + margin + mixpoint * w, y, x + margin + mixpoint * w, y + h)
end
-- preview point
local t = timer % 1
local t = love.timer.getTime() % 1
love.graphics.setColor(0.4, 0.4, 1, 0.4)
love.graphics.line(x + margin + t * w, y, x + margin + t * w, y + h)
@ -101,7 +81,7 @@ function self.render()
local a1 = ease.ease(t)
local a2 = ease.ease(math.max(math.min(t - 0.1, 1), 0))
local da = a1
if timer % 2 > 1 and math.floor(ease.ease(0) + 0.5) ~= math.floor(ease.ease(1) + 0.5) then
if love.timer.getTime() % 2 < 1 and math.floor(ease.ease(0) + 0.5) ~= math.floor(ease.ease(1) + 0.5) then
da = 1 - da
end
if minEase then

View file

@ -94,7 +94,6 @@ function love.draw()
if mx > x and mx < x + w and my > y and my < y + h and love.mouse.isDown(1) and dropdown.openDropdown == 0 then
mixpoint = (mx - x) / w
graph.touchtimer = 1
dropdown.createDropdowns()
end
end