multiply mode

This commit is contained in:
jill 2021-09-19 13:16:27 +03:00
parent c44579b508
commit fbd5277cdb
4 changed files with 37 additions and 6 deletions

View file

@ -89,6 +89,7 @@ function self.createDropdowns()
options = {
'Preview Ease',
'Mix Eases',
'Multiply Eases',
'Create Ease'
},
name = 'mode'
@ -99,7 +100,7 @@ function self.createDropdowns()
local eases = skeys(ease.eases)
if d[dropdownId].selected == 1 then -- preview ease
if d[dropdownId].selected == modes.preview then -- preview ease
insertDropdown(d, {
x = outerpadding + dropdownWidth + padding,
y = outerpadding,
@ -115,7 +116,7 @@ function self.createDropdowns()
ease.ease = function(x)
return _e.f(x, param1[1], param1[2])
end
elseif d[dropdownId].selected == 2 then -- mix eases
elseif d[dropdownId].selected == modes.mix then -- mix eases
insertDropdown(d, {
x = outerpadding + dropdownWidth + padding,
y = outerpadding,
@ -142,7 +143,36 @@ function self.createDropdowns()
param2[1] = slider.kvalue(_e2.name .. 'param21') or (_e2.params[1] and _e2.params[1].default) or 1
param2[2] = slider.kvalue(_e2.name .. 'param22') or (_e2.params[2] and _e2.params[2].default) or 1
ease.ease = ease.mixEase(_e1.f, _e2.f, slider.kvalue('mix'), param1, param2)
elseif d[dropdownId].selected == 3 then -- create eases
elseif d[dropdownId].selected == modes.multiply then -- mult eases
insertDropdown(d, {
x = outerpadding + dropdownWidth + padding,
y = outerpadding,
width = dropdownWidth,
options = eases,
name = 'ease1',
icons = icons(eases),
params = params(eases)
})
insertDropdown(d, {
x = outerpadding + dropdownWidth + padding + dropdownWidth + padding,
y = outerpadding,
width = dropdownWidth,
options = eases,
name = 'ease2',
icons = icons(eases),
params = params(eases)
})
local _e1 = ease.eases[d[dropdownId - 1].options[d[dropdownId - 1].selected]]
local _e2 = ease.eases[d[dropdownId].options[d[dropdownId].selected]]
param1[1] = slider.kvalue(_e1.name .. 'param11') or (_e1.params[1] and _e1.params[1].default) or 1
param1[2] = slider.kvalue(_e1.name .. 'param12') or (_e1.params[2] and _e1.params[2].default) or 1
param2[1] = slider.kvalue(_e2.name .. 'param21') or (_e2.params[1] and _e2.params[1].default) or 1
param2[2] = slider.kvalue(_e2.name .. 'param22') or (_e2.params[2] and _e2.params[2].default) or 1
ease.ease = function(x)
return _e2.f(_e1.f(x, param1[1], param1[2]), param2[1], param2[2])
end
elseif d[dropdownId].selected == modes.create then -- create eases
insertDropdown(d, {
x = outerpadding + dropdownWidth + padding,
y = outerpadding,

View file

@ -46,7 +46,7 @@ end
function self.render()
local sw, sh = love.graphics.getDimensions()
if mode == modes.preview or mode == modes.mix then
if mode == modes.preview or mode == modes.mix or mode == modes.multiply then
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)

View file

@ -15,7 +15,8 @@ graph = require 'graph'
modes = {
preview = 1,
mix = 2,
create = 3
multiply = 3,
create = 4
}
function createUI()

View file

@ -50,7 +50,7 @@ function self.createSliders()
displayname = 'Mix'
})
end
if mode == modes.preview or mode == modes.mix then -- bpm slider
if mode == modes.preview or mode == modes.mix or mode == modes.multiply then -- bpm slider
insertSlider(s, {
x = outerpadding,
y = love.graphics.getHeight() - outerpadding - fontHeight * 3 - padding,