mirror of
https://github.com/Insality/druid.git
synced 2025-09-28 02:22:18 +02:00
Update example with new brand one
This commit is contained in:
29
example/examples/basic/hotkey/basic_hotkey.lua
Normal file
29
example/examples/basic/hotkey/basic_hotkey.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
local hotkey = require("druid.extended.hotkey")
|
||||
|
||||
local component = require("druid.component")
|
||||
|
||||
---@class basic_hotkey: druid.base_component
|
||||
---@field druid druid_instance
|
||||
---@field root node
|
||||
---@field text druid.text
|
||||
local M = component.create("basic_hotkey")
|
||||
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
self.root = self:get_node("root")
|
||||
self.hotkey = self.druid:new(hotkey, { "key_lshift", "key_x" }, self.on_hotkey)
|
||||
end
|
||||
|
||||
|
||||
function M:on_hotkey()
|
||||
gui.animate(self.root, gui.PROP_SCALE, vmath.vector3(1.2), gui.EASING_OUTELASTIC, 0.5, 0, function()
|
||||
gui.animate(self.root, gui.PROP_SCALE, vmath.vector3(1), gui.EASING_OUTELASTIC, 0.5)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
Reference in New Issue
Block a user