From df3bfb150a6cc4843e8ce785770b9bef40f5315a Mon Sep 17 00:00:00 2001 From: jill Date: Sat, 18 Sep 2021 13:21:53 +0300 Subject: [PATCH] add pulse ease icon & line width --- dropdown.lua | 3 +++ easelib.lua | 10 +++++----- main.lua | 3 +++ pulseease-icon.png | Bin 0 -> 168 bytes 4 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 pulseease-icon.png diff --git a/dropdown.lua b/dropdown.lua index 1b3b39d..ec953c6 100644 --- a/dropdown.lua +++ b/dropdown.lua @@ -8,6 +8,7 @@ local icon = { unknownease = love.graphics.newImage('unknownease-icon.png'), linearease = love.graphics.newImage('linearease-icon.png'), instantease = love.graphics.newImage('instantease-icon.png'), + pulseease = love.graphics.newImage('pulseease-icon.png'), } local dropdowns = {} @@ -178,6 +179,7 @@ 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.setLineWidth(1) 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 @@ -229,6 +231,7 @@ function self.render() love.graphics.rectangle('fill', x + w - size, y + h + scroll * (1 - displayed) * (maxDropdown - 1) * h * v.open, size, displayed * (maxDropdown - 1) * h * v.open) end end + love.graphics.setLineWidth(lineWidth) end end diff --git a/easelib.lua b/easelib.lua index 559ef62..ea5a901 100644 --- a/easelib.lua +++ b/easelib.lua @@ -27,24 +27,24 @@ table.insert(self, {'tri', function(t) return 1 - abs(2 * t - 1) end, type = 'tr table.insert(self, {'bell', function(t) return self.inOutQuint(self.tri(t)) end, type = 'transient'}) table.insert(self, {'pop', function(t) return 3.5 * (1 - t) * (1 - t) * sqrt(t) end, type = 'transient'}) table.insert(self, {'tap', function(t) return 3.5 * t * t * sqrt(1 - t) end, type = 'transient'}) -table.insert(self, {'pulse', function(t) return t < .5 and self.tap(t * 2) or -self.pop(t * 2 - 1) end, type = 'transient'}) +table.insert(self, {'pulse', function(t) return t < .5 and self.tap(t * 2) or -self.pop(t * 2 - 1) end, type = 'pulse'}) table.insert(self, {'spike', function(t) return exp(-10 * abs(2 * t - 1)) end, type = 'transient'}) -table.insert(self, {'inverse', function(t) return t * t * (1 - t) * (1 - t) / (0.5 - t) end, type = 'transient'}) +table.insert(self, {'inverse', function(t) return t * t * (1 - t) * (1 - t) / (0.5 - t) end, type = 'pulse'}) table.insert(self, {'popElastic', function(t, damp, count) return (1000 ^ -(t ^ damp) - 0.001) * sin(count * pi * t) -end, {1, 10, 1.4, 'damp'}, {1, 25, 6, 'count'}, type = 'transient'}) +end, {1, 10, 1.4, 'damp'}, {1, 25, 6, 'count'}, type = 'pulse'}) table.insert(self, {'tapElastic', function(t, damp, count) return (1000 ^ -((1 - t) ^ damp) - 0.001) * sin(count * pi * (1 - t)) -end, {1, 10, 1.4, 'damp'}, {1, 25, 6, 'count'}, type = 'transient'}) +end, {1, 10, 1.4, 'damp'}, {1, 25, 6, 'count'}, type = 'pulse'}) table.insert(self, {'pulseElastic', function(t, damp, count) if t < .5 then return self.tapElastic(t * 2, damp, count) else return -self.popElastic(t * 2 - 1, damp, count) end -end, {1, 10, 1.4, 'damp'}, {1, 25, 6, 'count'}, type = 'transient'}) +end, {1, 10, 1.4, 'damp'}, {1, 25, 6, 'count'}, type = 'pulse'}) table.insert(self, {'impulse', function(t, damp) t = t ^ damp diff --git a/main.lua b/main.lua index c7a1e35..384b414 100644 --- a/main.lua +++ b/main.lua @@ -25,6 +25,7 @@ padding = 16 outerpadding = 22 margin = 6 dropdownWidth = 128 +lineWidth = 2 fontHeight = love.graphics.getFont():getHeight() -- global for convinience's sake @@ -47,6 +48,8 @@ function love.draw() local sw, sh = love.graphics.getDimensions() local mx, my = love.mouse.getPosition() + love.graphics.setLineWidth(2) + love.graphics.setColor(0.09, 0.09, 0.12, 1) love.graphics.rectangle('fill', 0, 0, sw, sh) love.graphics.setColor(0.08, 0.08, 0.1, 1) diff --git a/pulseease-icon.png b/pulseease-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..fcb76920ace1f14477a492643a658ae784a10e8d GIT binary patch literal 168 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|l001;Lo9le z6BdYB)c!tSU-ZQ=Fw5{L+lB;TpLu`f-_6~*vZu#oCJQ%n%Gnz~UNr1VoM7|&e|^%N zIUtH>`onIwl%p@CG`}$g>NVW#F?V3sQ8fxm+PzYXTj|&d)0QL#h9#wzJ6au?LGEDi MboFyt=akR{00{g%ga7~l literal 0 HcmV?d00001