#61 fix button anim node

This commit is contained in:
Insality 2020-05-16 16:54:48 +03:00
parent bcb7ae04b3
commit 2db45b27e2
3 changed files with 282 additions and 1 deletions

View File

@ -165,7 +165,7 @@ function M.init(self, node, callback, params, anim_node)
self.druid = self:get_druid() self.druid = self:get_druid()
self.node = self:get_node(node) self.node = self:get_node(node)
self.anim_node = anim_node and helper:get_node(anim_node) or self.node self.anim_node = anim_node and self:get_node(anim_node) or self.node
self.start_scale = gui.get_scale(self.anim_node) self.start_scale = gui.get_scale(self.anim_node)
self.start_pos = gui.get_position(self.anim_node) self.start_pos = gui.get_position(self.anim_node)
self.params = params self.params = params

View File

@ -5286,6 +5286,284 @@ nodes {
text_leading: 1.0 text_leading: 1.0
text_tracking: 0.0 text_tracking: 0.0
} }
nodes {
position {
x: 0.0
y: 280.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 200.0
y: 100.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEMPLATE
id: "button_anim"
parent: "button_page"
layer: ""
inherit_alpha: true
alpha: 1.0
template: "/example/templates/button.gui"
template_node_child: false
}
nodes {
position {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 130.0
y: 60.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/button_blue"
id: "button_anim/button"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "button_anim"
layer: "image"
inherit_alpha: true
slice9 {
x: 15.0
y: 15.0
z: 15.0
w: 15.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: true
size_mode: SIZE_MODE_MANUAL
}
nodes {
position {
x: 0.0
y: 7.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.6
y: 0.6
z: 1.0
w: 1.0
}
size {
x: 200.0
y: 100.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "Anim node"
font: "game"
id: "button_anim/text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 0.101960786
y: 0.2
z: 0.6
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "button_anim/button"
layer: "text"
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.78
overridden_fields: 3
overridden_fields: 8
template_node_child: true
text_leading: 1.0
text_tracking: 0.0
}
nodes {
position {
x: 62.0
y: 305.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
size {
x: 36.0
y: 36.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 0.4
w: 1.0
}
type: TYPE_BOX
blend_mode: BLEND_MODE_ALPHA
texture: "kenney/slider_move"
id: "anim_node_icon"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
adjust_mode: ADJUST_MODE_FIT
parent: "button_page"
layer: ""
inherit_alpha: true
slice9 {
x: 0.0
y: 0.0
z: 0.0
w: 0.0
}
clipping_mode: CLIPPING_MODE_NONE
clipping_visible: true
clipping_inverted: false
alpha: 1.0
template_node_child: false
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 2.0
y: 2.0
z: 0.0
w: 1.0
}
rotation {
x: 0.0
y: 0.0
z: 0.0
w: 1.0
}
scale {
x: 0.8
y: 0.8
z: 1.0
w: 1.0
}
size {
x: 40.0
y: 40.0
z: 0.0
w: 1.0
}
color {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
type: TYPE_TEXT
blend_mode: BLEND_MODE_ALPHA
text: "?"
font: "game"
id: "anim_node_text"
xanchor: XANCHOR_NONE
yanchor: YANCHOR_NONE
pivot: PIVOT_CENTER
outline {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
w: 1.0
}
adjust_mode: ADJUST_MODE_FIT
line_break: false
parent: "anim_node_icon"
layer: ""
inherit_alpha: true
alpha: 1.0
outline_alpha: 0.0
shadow_alpha: 0.0
template_node_child: false
text_leading: 1.0
text_tracking: 0.0
}
nodes { nodes {
position { position {
x: 1800.0 x: 1800.0

View File

@ -42,6 +42,9 @@ local function setup_buttons(self)
button_space:set_key_trigger("key_space") button_space:set_key_trigger("key_space")
button_space.on_long_click:subscribe(long_tap_callback) button_space.on_long_click:subscribe(long_tap_callback)
button_space.on_double_click:subscribe(double_tap_callback) button_space.on_double_click:subscribe(double_tap_callback)
-- Button with another node for animating
self.druid:new_button("button_anim/button", usual_callback, nil, "anim_node_icon")
end end