3
0
mirror of https://github.com/britzl/monarch.git synced 2025-11-26 19:00:53 +01:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Björn Ritzl
354dc71b12 Don't create a transition for a node if one already exists
Fixes #50
2019-08-03 15:40:06 +02:00

View File

@@ -122,6 +122,19 @@ local function create()
local function create_transition(transition_id, node, fn, easing, duration, delay)
local t = transitions[transition_id]
-- find if there's already a transition for the node in
-- question and if so update it instead of creating a new
-- transition
for _,transition in ipairs(t) do
if transition.node == node then
transition.fn = fn
transition.easing = easing
transition.duration = duration
transitions.delay = delay
return
end
end
-- create new transition
t.transitions[#t.transitions + 1] = {
node = node,
node_data = {