42 lines
1001 B
Lua

local druid = require("druid.druid")
function init(self)
self.druid = druid.new(self)
local hover = self.druid:new_hover("hover_node/button")
-- Usual hover respect to touch action on mobiles. On desktop we will use mouse hover
hover.on_mouse_hover:subscribe(function(_, is_hover, hover_instance)
print("is hover", is_hover)
local node = hover_instance.node
gui.animate(node, gui.PROP_SCALE, is_hover and vmath.vector3(1.2) or vmath.vector3(1), gui.EASING_OUTSINE, 0.2)
end)
local button = self.druid:new_button("hover_node/button", function()
print("Button clicked")
end)
-- Remove all animations from button, including button hover animations
button:set_style()
end
function final(self)
self.druid:final()
end
function update(self, dt)
self.druid:update(dt)
end
function on_message(self, message_id, message, sender)
self.druid:on_message(message_id, message, sender)
end
function on_input(self, action_id, action)
return self.druid:on_input(action_id, action)
end