mirror of
https://github.com/Insality/druid
synced 2025-09-27 18:12:21 +02:00
Update example with new brand one
This commit is contained in:
241
example/examples/panthera/basic_animation/basic_animation.gui
Normal file
241
example/examples/panthera/basic_animation/basic_animation.gui
Normal file
@@ -0,0 +1,241 @@
|
||||
script: ""
|
||||
textures {
|
||||
name: "druid"
|
||||
texture: "/example/assets/druid.atlas"
|
||||
}
|
||||
background_color {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 0.0
|
||||
}
|
||||
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: 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_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: ""
|
||||
id: "root"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
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
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
visible: false
|
||||
material: ""
|
||||
}
|
||||
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: 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"
|
||||
parent: "root"
|
||||
layer: ""
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
template: "/example/templates/button_text_blue.gui"
|
||||
template_node_child: false
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
}
|
||||
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: 280.0
|
||||
y: 90.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.631
|
||||
y: 0.843
|
||||
z: 0.961
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_BOX
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
texture: "druid/ui_circle_32"
|
||||
id: "button/root"
|
||||
xanchor: XANCHOR_NONE
|
||||
yanchor: YANCHOR_NONE
|
||||
pivot: PIVOT_CENTER
|
||||
adjust_mode: ADJUST_MODE_FIT
|
||||
parent: "button"
|
||||
layer: "druid"
|
||||
inherit_alpha: true
|
||||
slice9 {
|
||||
x: 16.0
|
||||
y: 16.0
|
||||
z: 16.0
|
||||
w: 16.0
|
||||
}
|
||||
clipping_mode: CLIPPING_MODE_NONE
|
||||
clipping_visible: true
|
||||
clipping_inverted: false
|
||||
alpha: 1.0
|
||||
template_node_child: true
|
||||
size_mode: SIZE_MODE_MANUAL
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
visible: true
|
||||
material: ""
|
||||
}
|
||||
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: 245.0
|
||||
y: 50.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
color {
|
||||
x: 0.31
|
||||
y: 0.318
|
||||
z: 0.322
|
||||
w: 1.0
|
||||
}
|
||||
type: TYPE_TEXT
|
||||
blend_mode: BLEND_MODE_ALPHA
|
||||
text: "Hover Me!"
|
||||
font: "text_bold"
|
||||
id: "button/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: "button/root"
|
||||
layer: "text_bold"
|
||||
inherit_alpha: true
|
||||
alpha: 1.0
|
||||
outline_alpha: 0.0
|
||||
shadow_alpha: 0.0
|
||||
overridden_fields: 8
|
||||
template_node_child: true
|
||||
text_leading: 1.0
|
||||
text_tracking: 0.0
|
||||
custom_type: 0
|
||||
enabled: true
|
||||
visible: true
|
||||
material: ""
|
||||
}
|
||||
material: "/builtins/materials/gui.material"
|
||||
adjust_reference: ADJUST_REFERENCE_PARENT
|
||||
max_nodes: 512
|
@@ -0,0 +1,37 @@
|
||||
local panthera = require("panthera.panthera")
|
||||
local component = require("druid.component")
|
||||
|
||||
local basic_animation_panthera = require("example.examples.panthera.basic_animation.basic_animation_panthera")
|
||||
|
||||
---@class basic_animation: druid.base_component
|
||||
---@field druid druid_instance
|
||||
local M = component.create("basic_animation")
|
||||
|
||||
|
||||
---@param template string
|
||||
---@param nodes table<hash, node>
|
||||
function M:init(template, nodes)
|
||||
self.druid = self:get_druid(template, nodes)
|
||||
|
||||
self.animation = panthera.create_gui(basic_animation_panthera, self:get_template(), nodes)
|
||||
|
||||
self.button = self.druid:new_button("button/root", function()
|
||||
panthera.play(self.animation, "on_click", {
|
||||
is_skip_init = true
|
||||
})
|
||||
end)
|
||||
self.button:set_style(nil) -- Reset all button style animations
|
||||
|
||||
self.button.hover.on_mouse_hover:subscribe(function(_, is_hover)
|
||||
if is_hover then
|
||||
panthera.play(self.animation, "on_hover")
|
||||
else
|
||||
panthera.play(self.animation, "reset", {
|
||||
is_skip_init = true
|
||||
})
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
return M
|
@@ -0,0 +1,319 @@
|
||||
return {
|
||||
version = 1,
|
||||
format = "json",
|
||||
data = {
|
||||
animations = {
|
||||
{
|
||||
duration = 0.35,
|
||||
animation_keys = {
|
||||
{
|
||||
key_type = "trigger",
|
||||
data = "C",
|
||||
property_id = "text",
|
||||
start_data = "Hover Me!",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 0.624,
|
||||
property_id = "color_b",
|
||||
start_value = 0.961,
|
||||
duration = 0.35,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 0.875,
|
||||
property_id = "color_g",
|
||||
start_value = 0.843,
|
||||
duration = 0.35,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 0.902,
|
||||
property_id = "color_r",
|
||||
start_value = 0.631,
|
||||
duration = 0.35,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outback",
|
||||
end_value = 1.3,
|
||||
property_id = "scale_x",
|
||||
start_value = 1,
|
||||
duration = 0.35,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outback",
|
||||
end_value = 1.3,
|
||||
property_id = "scale_y",
|
||||
start_value = 1,
|
||||
duration = 0.35,
|
||||
},
|
||||
{
|
||||
key_type = "trigger",
|
||||
start_time = 0.047,
|
||||
data = "Cl",
|
||||
start_data = "C",
|
||||
property_id = "text",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
{
|
||||
key_type = "trigger",
|
||||
start_time = 0.1,
|
||||
data = "Cli",
|
||||
start_data = "Cl",
|
||||
property_id = "text",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
{
|
||||
key_type = "trigger",
|
||||
start_time = 0.145,
|
||||
data = "Clic",
|
||||
start_data = "Cli",
|
||||
property_id = "text",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
{
|
||||
key_type = "trigger",
|
||||
start_time = 0.195,
|
||||
data = "Click",
|
||||
start_data = "Clic",
|
||||
property_id = "text",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
{
|
||||
key_type = "trigger",
|
||||
start_time = 0.24,
|
||||
data = "Click M",
|
||||
start_data = "Click",
|
||||
property_id = "text",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
{
|
||||
key_type = "trigger",
|
||||
start_time = 0.293,
|
||||
data = "Click Me",
|
||||
start_data = "Click M",
|
||||
property_id = "text",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
{
|
||||
key_type = "trigger",
|
||||
start_time = 0.34,
|
||||
data = "Click Me!",
|
||||
start_data = "Click Me",
|
||||
property_id = "text",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
},
|
||||
animation_id = "on_hover",
|
||||
},
|
||||
{
|
||||
duration = 0.35,
|
||||
initial_state = "on_hover",
|
||||
animation_id = "on_click",
|
||||
animation_keys = {
|
||||
{
|
||||
key_type = "trigger",
|
||||
data = "BOOM",
|
||||
property_id = "text",
|
||||
start_data = "Click Me!",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/text",
|
||||
easing = "outsine",
|
||||
end_value = 1.3,
|
||||
property_id = "scale_x",
|
||||
start_value = 1,
|
||||
duration = 0.1,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/text",
|
||||
easing = "outsine",
|
||||
end_value = 1.3,
|
||||
property_id = "scale_y",
|
||||
start_value = 1,
|
||||
duration = 0.1,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 0.608,
|
||||
property_id = "color_b",
|
||||
start_value = 0.624,
|
||||
duration = 0.2,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 0.608,
|
||||
property_id = "color_g",
|
||||
start_value = 0.875,
|
||||
duration = 0.2,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 0.957,
|
||||
property_id = "color_r",
|
||||
start_value = 0.902,
|
||||
duration = 0.2,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outback",
|
||||
end_value = 1.6,
|
||||
property_id = "scale_x",
|
||||
start_value = 1.3,
|
||||
duration = 0.2,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outback",
|
||||
end_value = 1.6,
|
||||
property_id = "scale_y",
|
||||
start_value = 1.3,
|
||||
duration = 0.2,
|
||||
},
|
||||
{
|
||||
node_id = "button/text",
|
||||
key_type = "tween",
|
||||
start_time = 0.1,
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
property_id = "scale_x",
|
||||
start_value = 1.3,
|
||||
duration = 0.13,
|
||||
},
|
||||
{
|
||||
node_id = "button/text",
|
||||
key_type = "tween",
|
||||
start_time = 0.1,
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
property_id = "scale_y",
|
||||
start_value = 1.3,
|
||||
duration = 0.13,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
duration = 0.5,
|
||||
animation_keys = {
|
||||
{
|
||||
key_type = "trigger",
|
||||
data = "Hover Me!",
|
||||
property_id = "text",
|
||||
start_data = "BOOM",
|
||||
easing = "linear",
|
||||
node_id = "button/text",
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/text",
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
property_id = "scale_x",
|
||||
start_value = 1,
|
||||
duration = 0.2,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/text",
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
property_id = "scale_y",
|
||||
start_value = 1,
|
||||
duration = 0.2,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 0.627,
|
||||
property_id = "color_r",
|
||||
start_value = 0.957,
|
||||
duration = 0.5,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 0.839,
|
||||
property_id = "color_g",
|
||||
start_value = 0.608,
|
||||
duration = 0.5,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 0.961,
|
||||
property_id = "color_b",
|
||||
start_value = 0.608,
|
||||
duration = 0.5,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
property_id = "scale_x",
|
||||
start_value = 1.5,
|
||||
duration = 0.5,
|
||||
},
|
||||
{
|
||||
key_type = "tween",
|
||||
node_id = "button/root",
|
||||
easing = "outsine",
|
||||
end_value = 1,
|
||||
property_id = "scale_y",
|
||||
start_value = 1.5,
|
||||
duration = 0.5,
|
||||
},
|
||||
},
|
||||
animation_id = "reset",
|
||||
},
|
||||
},
|
||||
metadata = {
|
||||
gui_path = "/example/examples/panthera/basic_animation/basic_animation.gui",
|
||||
layers = {
|
||||
},
|
||||
fps = 60,
|
||||
gizmo_steps = {
|
||||
},
|
||||
settings = {
|
||||
font_size = 40,
|
||||
},
|
||||
},
|
||||
nodes = {
|
||||
},
|
||||
},
|
||||
type = "animation_editor",
|
||||
}
|
Reference in New Issue
Block a user