Hey there,
So, I’ve read the docs and scoured the forum here and tried out a bunch of things but there must be something super obvious escaping me because I can’t get transitions to work in Monarch. I don’t get any errors, and the screen (popup in this case) displays totally fine, but transitions don’t show. I’ll paste the code from the gui below – it’s all just basically copy+paste from the docs. I’m sure there’s just a box I didn’t tick somewhere or something not right, but I just can’t figure it out. Thanks!
local monarch = require "monarch.monarch"
local transitions = require "monarch.transitions.gui"
function init(self)
local data = monarch.data("alert")
-- Reposition the root node
local root_node = gui.get_node("root")
gui.set_position(root_node, vmath.vector3(data.x, data.y, 0))
-- Set the title and content text
local title_node = gui.get_node("title")
local content_node = gui.get_node("content")
gui.set_text(title_node, data.title)
gui.set_text(content_node, data.content)
local transition = transitions.create(gui.get_node("root"))
.show_in(transitions.slide_in_right, gui.EASING_OUTQUAD, 0.6, 0)
.show_out(transitions.slide_out_left, gui.EASING_INQUAD, 0.6, 0)
.back_in(transitions.slide_in_left, gui.EASING_OUTQUAD, 0.6, 0)
.back_out(transitions.slide_out_right, gui.EASING_INQUAD, 0.6, 0)
monarch.on_transition("alert", transition)
msg.post(".", "acquire_input_focus")
end
function final(self)
end
function update(self, dt)
end
function on_message(self, message_id, message, sender)
monarch.on_message(message_id, message, sender)
-- you can also check when a transition has completed:
if message_id == monarch.TRANSITION.DONE and message.transition == monarch.TRANSITION.SHOW_IN then
print("Show in done!")
end
end
function on_input(self, action_id, action)
end
function on_reload(self)
end