Update example with new brand one

This commit is contained in:
Insality
2024-10-17 01:24:15 +03:00
parent 2c762716bb
commit 91879509a0
197 changed files with 36779 additions and 7 deletions

View File

@@ -0,0 +1,218 @@
fonts {
name: "text_bold"
font: "/example/assets/fonts/text_bold.font"
}
textures {
name: "animation_blend"
texture: "/example/examples/panthera/animation_blend/assets/animation_blend.atlas"
}
textures {
name: "druid"
texture: "/example/assets/druid.atlas"
}
nodes {
size {
x: 1000.0
y: 1000.0
}
color {
x: 0.173
y: 0.184
z: 0.204
}
type: TYPE_BOX
texture: "druid/ui_circle_64"
id: "root"
inherit_alpha: true
slice9 {
x: 32.0
y: 32.0
z: 32.0
w: 32.0
}
}
nodes {
size {
x: 100.0
y: 100.0
}
type: TYPE_BOX
id: "character"
parent: "root"
inherit_alpha: true
visible: false
}
nodes {
type: TYPE_BOX
texture: "animation_blend/pink_body_squircle"
id: "body"
parent: "character"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
y: 2.0
}
size {
x: 100.0
y: 40.0
}
type: TYPE_BOX
id: "eyes"
parent: "body"
inherit_alpha: true
visible: false
}
nodes {
position {
x: -32.0
}
type: TYPE_BOX
texture: "animation_blend/facial_part_eye_open"
id: "eye_left"
parent: "eyes"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
y: 34.0
}
rotation {
z: 5.0
}
type: TYPE_BOX
texture: "animation_blend/facial_part_eyebrow_b"
id: "brow_left"
parent: "eye_left"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 32.0
}
type: TYPE_BOX
texture: "animation_blend/facial_part_eye_open"
id: "eye_right"
parent: "eyes"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
y: 34.0
}
rotation {
z: -5.0
}
scale {
x: -1.0
}
type: TYPE_BOX
texture: "animation_blend/facial_part_eyebrow_b"
id: "brow_right"
parent: "eye_right"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
y: -35.0
}
type: TYPE_BOX
texture: "animation_blend/facial_part_mouth_happy"
id: "mouth"
parent: "body"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: 130.0
}
rotation {
z: -10.0
}
type: TYPE_BOX
texture: "animation_blend/pink_hand_open"
id: "hand_left"
parent: "body"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
x: -130.0
}
rotation {
z: 10.0
}
scale {
x: -1.0
}
type: TYPE_BOX
texture: "animation_blend/pink_hand_open"
id: "hand_right"
parent: "body"
inherit_alpha: true
size_mode: SIZE_MODE_AUTO
}
nodes {
position {
y: -445.0
}
size {
x: 600.0
y: 100.0
}
color {
x: 0.31
y: 0.318
z: 0.322
}
type: TYPE_TEXT
text: "Hover mouse over this area"
font: "text_bold"
id: "text_hint"
outline {
x: 1.0
y: 1.0
z: 1.0
}
shadow {
x: 1.0
y: 1.0
z: 1.0
}
parent: "root"
inherit_alpha: true
outline_alpha: 0.0
shadow_alpha: 0.0
}
nodes {
position {
x: -200.0
y: 430.0
}
size {
x: 400.0
y: 100.0
}
color {
x: 0.941
y: 0.984
}
type: TYPE_TEXT
text: "Rich text"
font: "text_bold"
id: "rich_text_kenney"
pivot: PIVOT_W
parent: "root"
inherit_alpha: true
outline_alpha: 0.0
shadow_alpha: 0.0
}
material: "/builtins/materials/gui.material"
adjust_reference: ADJUST_REFERENCE_PARENT

View File

@@ -0,0 +1,75 @@
local panthera = require("panthera.panthera")
local component = require("druid.component")
local helper = require("druid.helper")
local event = require("druid.event")
local lang_text = require("druid.extended.lang_text")
local rich_text = require("druid.custom.rich_text.rich_text")
local character_animation_blend = require("example.examples.panthera.animation_blend.character_animation_blend")
---@class animation_blend: druid.base_component
---@field root node
---@field druid druid_instance
local M = component.create("animation_blend")
---@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.root_size = gui.get_size(self.root)
self.druid:new(lang_text, "text_hint", "ui_example_panthera_animation_blend_hint")
self.animation_idle = panthera.create_gui(character_animation_blend, self:get_template(), nodes)
self.animation_vertical = panthera.create_gui(character_animation_blend, self:get_template(), nodes)
self.animation_horizontal = panthera.create_gui(character_animation_blend, self:get_template(), nodes)
panthera.play(self.animation_idle, "idle", {
is_loop = true,
})
self:setup_rich_text()
self.on_update = event()
end
---@param action_id hash
---@param action action
function M:on_input(action_id, action)
if action_id == nil and gui.pick_node(self.root, action.x, action.y) then
local root_screen_pos = gui.get_screen_position(self.root)
local gui_scale = helper.get_gui_scale()
local dx = (action.screen_x - root_screen_pos.x) / gui_scale -- -root_size.x / 2 .. root_size.x / 2
local animation_progress_x = (dx + self.root_size.x / 2) / self.root_size.x -- 0 .. 1
panthera.set_time(self.animation_horizontal, "horizontal", animation_progress_x)
local dy = (action.screen_y - root_screen_pos.y) / gui_scale -- -root_size.y / 2 .. root_size.y / 2
local animation_progress_y = (dy + self.root_size.y / 2) / self.root_size.y -- 0 .. 1
panthera.set_time(self.animation_vertical, "vertical", animation_progress_y)
end
end
function M:update()
self.on_update:trigger()
end
function M:setup_rich_text()
self.rich_text = self.druid:new(rich_text, "rich_text_kenney", "Character assets by <color=865BD9><link>Kenney</link></color>")
local tagged = self.rich_text:tagged("link")
for index = 1, #tagged do
---@type druid.rich_text.word
local word = tagged[index]
self.druid:new_button(word.node, function()
sys.open_url("https://kenney.nl/")
end)
end
end
return M

View File

@@ -0,0 +1,46 @@
images {
image: "/example/examples/panthera/animation_blend/assets/facial_part_eye_open.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/examples/panthera/animation_blend/assets/facial_part_eyebrow_b.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/examples/panthera/animation_blend/assets/facial_part_mouth_happy.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/examples/panthera/animation_blend/assets/facial_part_mouth_smirk.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/examples/panthera/animation_blend/assets/pink_body_squircle.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/examples/panthera/animation_blend/assets/pink_hand_closed.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/examples/panthera/animation_blend/assets/pink_hand_open.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/examples/panthera/animation_blend/assets/pink_hand_point.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/examples/panthera/animation_blend/assets/shadow.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
images {
image: "/example/examples/panthera/animation_blend/assets/facial_part_eye_half_top.png"
sprite_trim_mode: SPRITE_TRIM_MODE_OFF
}
margin: 0
extrude_borders: 2
inner_padding: 0
max_page_width: 0
max_page_height: 0
rename_patterns: ""

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 B

View File

@@ -0,0 +1,633 @@
return {
data = {
animations = {
{
animation_id = "default",
duration = 1,
animation_keys = {
},
},
{
animation_id = "horizontal",
duration = 1,
animation_keys = {
{
key_type = "tween",
node_id = "eyes",
easing = "outsine",
end_value = -20,
property_id = "position_x",
},
{
key_type = "tween",
node_id = "mouth",
easing = "outsine",
end_value = -20,
property_id = "position_x",
},
{
key_type = "tween",
node_id = "mouth",
easing = "outsine",
end_value = -4,
property_id = "rotation_z",
},
{
key_type = "tween",
node_id = "hand_right",
start_value = -1,
end_value = -0.8,
easing = "outsine",
property_id = "scale_x",
},
{
key_type = "tween",
node_id = "eye_left",
start_value = 1,
end_value = 0.8,
easing = "outsine",
property_id = "scale_x",
},
{
key_type = "tween",
node_id = "eye_left",
start_value = 1,
end_value = 0.8,
easing = "outsine",
property_id = "scale_y",
},
{
key_type = "tween",
node_id = "hand_right",
start_value = 1,
end_value = 0.8,
easing = "outsine",
property_id = "scale_y",
},
{
key_type = "tween",
node_id = "mouth",
start_value = 1,
end_value = 0.9,
easing = "outsine",
property_id = "scale_x",
},
{
key_type = "tween",
node_id = "mouth",
start_value = 1,
end_value = 0.9,
easing = "outsine",
property_id = "scale_y",
},
{
key_type = "tween",
node_id = "hand_left",
start_value = 1,
end_value = 1.2,
easing = "outsine",
property_id = "color_a",
},
{
key_type = "tween",
node_id = "hand_left",
start_value = 1,
end_value = 1.5,
easing = "outsine",
property_id = "scale_x",
},
{
key_type = "tween",
node_id = "hand_left",
start_value = 1,
end_value = 1.5,
easing = "outsine",
property_id = "scale_y",
},
{
key_type = "tween",
node_id = "eye_left",
easing = "outsine",
end_value = 2,
property_id = "position_y",
},
{
key_type = "tween",
node_id = "hand_left",
start_value = 130,
end_value = 110,
easing = "outsine",
property_id = "position_x",
},
{
duration = 0.75,
key_type = "tween",
node_id = "eye_left",
easing = "outsine",
start_value = 2,
property_id = "position_y",
},
{
duration = 0.75,
key_type = "tween",
node_id = "eye_left",
easing = "outsine",
end_value = 1,
start_value = 0.8,
property_id = "scale_x",
},
{
duration = 0.75,
key_type = "tween",
node_id = "eye_left",
easing = "outsine",
end_value = 1,
start_value = 0.8,
property_id = "scale_y",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_right",
easing = "linear",
end_value = -110,
start_value = -130,
property_id = "position_x",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_right",
easing = "outsine",
end_value = -1.5,
start_value = -0.8,
property_id = "scale_x",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_left",
easing = "outsine",
end_value = 0.8,
start_value = 1.5,
property_id = "scale_x",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_left",
easing = "outsine",
end_value = 0.8,
start_value = 1.5,
property_id = "scale_y",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_left",
easing = "outsine",
end_value = 1,
start_value = 1.2,
property_id = "color_a",
},
{
duration = 1,
key_type = "tween",
node_id = "mouth",
easing = "inoutsine",
end_value = 1.1,
start_value = 0.9,
property_id = "scale_x",
},
{
duration = 1,
key_type = "tween",
node_id = "mouth",
easing = "inoutsine",
end_value = 1.1,
start_value = 0.9,
property_id = "scale_y",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_right",
easing = "outsine",
end_value = 1.2,
start_value = 1,
property_id = "color_a",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_right",
easing = "outsine",
end_value = 1.5,
start_value = 0.8,
property_id = "scale_y",
},
{
duration = 1,
key_type = "tween",
node_id = "mouth",
easing = "inoutsine",
end_value = 4,
start_value = -4,
property_id = "rotation_z",
},
{
duration = 1,
key_type = "tween",
node_id = "eyes",
easing = "inoutsine",
end_value = 20,
start_value = -20,
property_id = "position_x",
},
{
duration = 1,
key_type = "tween",
node_id = "mouth",
easing = "inoutsine",
end_value = 20,
start_value = -20,
property_id = "position_x",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_left",
easing = "linear",
end_value = 130,
start_value = 110,
property_id = "position_x",
},
{
duration = 0.75,
key_type = "tween",
node_id = "eye_right",
easing = "outsine",
start_value = 1,
end_value = 0.8,
start_time = 0.25,
property_id = "scale_x",
},
{
duration = 0.75,
key_type = "tween",
node_id = "eye_right",
easing = "outsine",
start_value = 1,
end_value = 0.8,
start_time = 0.25,
property_id = "scale_y",
},
{
duration = 0.75,
key_type = "tween",
node_id = "eye_right",
easing = "outsine",
end_value = 2,
start_time = 0.25,
property_id = "position_y",
},
},
},
{
animation_id = "vertical",
duration = 1,
animation_keys = {
{
key_type = "tween",
node_id = "mouth",
start_value = -35,
end_value = -50,
easing = "outsine",
property_id = "position_y",
},
{
key_type = "tween",
node_id = "hand_left",
easing = "outsine",
end_value = -35,
property_id = "position_y",
},
{
key_type = "tween",
node_id = "hand_left",
start_value = -10,
end_value = -35,
easing = "outsine",
property_id = "rotation_z",
},
{
key_type = "tween",
node_id = "hand_right",
easing = "outsine",
end_value = -35,
property_id = "position_y",
},
{
key_type = "tween",
node_id = "eyes",
start_value = 2,
end_value = -10,
easing = "outsine",
property_id = "position_y",
},
{
key_type = "tween",
node_id = "brow_left",
start_value = 5,
easing = "outsine",
property_id = "rotation_z",
},
{
key_type = "tween",
node_id = "brow_right",
start_value = -5,
easing = "outsine",
property_id = "rotation_z",
},
{
key_type = "trigger",
node_id = "hand_left",
easing = "linear",
data = "animation_blend/pink_hand_point",
start_data = "animation_blend/pink_hand_open",
property_id = "texture",
},
{
key_type = "trigger",
node_id = "hand_right",
easing = "linear",
data = "animation_blend/pink_hand_point",
start_data = "animation_blend/pink_hand_open",
property_id = "texture",
},
{
key_type = "trigger",
node_id = "mouth",
easing = "linear",
data = "animation_blend/facial_part_mouth_smirk",
start_data = "animation_blend/facial_part_mouth_happy",
property_id = "texture",
},
{
key_type = "tween",
node_id = "hand_right",
start_value = 10,
end_value = 35,
easing = "outsine",
property_id = "rotation_z",
},
{
duration = 1,
key_type = "tween",
node_id = "mouth",
easing = "inoutsine",
end_value = -20,
start_value = -50,
property_id = "position_y",
},
{
duration = 1,
key_type = "tween",
node_id = "brow_right",
easing = "outsine",
end_value = -10,
property_id = "rotation_z",
},
{
duration = 1,
key_type = "tween",
node_id = "brow_left",
easing = "outsine",
end_value = -5,
property_id = "position_x",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_left",
easing = "outsine",
start_value = -35,
property_id = "rotation_z",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_right",
easing = "outsine",
start_value = 35,
property_id = "rotation_z",
},
{
duration = 1,
key_type = "tween",
node_id = "character",
easing = "outsine",
end_value = 0.96,
start_value = 1,
property_id = "scale_x",
},
{
duration = 1,
key_type = "tween",
node_id = "character",
easing = "outsine",
end_value = 1.04,
start_value = 1,
property_id = "scale_y",
},
{
duration = 1,
key_type = "tween",
node_id = "brow_right",
easing = "outsine",
end_value = 5,
property_id = "position_x",
},
{
duration = 1,
key_type = "tween",
node_id = "brow_left",
easing = "outsine",
end_value = 15,
property_id = "rotation_z",
},
{
duration = 1,
key_type = "tween",
node_id = "eyes",
easing = "inoutsine",
end_value = 25,
start_value = -10,
property_id = "position_y",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_left",
easing = "insine",
end_value = 100,
start_value = -35,
property_id = "position_y",
},
{
duration = 1,
key_type = "tween",
node_id = "hand_right",
easing = "insine",
end_value = 100,
start_value = -35,
property_id = "position_y",
},
{
start_time = 0.4,
key_type = "trigger",
node_id = "hand_left",
easing = "linear",
data = "animation_blend/pink_hand_closed",
start_data = "animation_blend/pink_hand_point",
property_id = "texture",
},
{
start_time = 0.4,
key_type = "trigger",
node_id = "hand_right",
easing = "linear",
data = "animation_blend/pink_hand_closed",
start_data = "animation_blend/pink_hand_point",
property_id = "texture",
},
{
start_time = 0.41,
key_type = "trigger",
node_id = "mouth",
easing = "linear",
data = "animation_blend/facial_part_mouth_happy",
start_data = "animation_blend/facial_part_mouth_smirk",
property_id = "texture",
},
{
start_time = 0.62,
key_type = "trigger",
node_id = "eye_left",
easing = "linear",
data = "animation_blend/facial_part_eye_half_top",
start_data = "animation_blend/facial_part_eye_open",
property_id = "texture",
},
{
start_time = 0.62,
key_type = "trigger",
node_id = "eye_right",
easing = "linear",
data = "animation_blend/facial_part_eye_half_top",
start_data = "animation_blend/facial_part_eye_open",
property_id = "texture",
},
{
start_time = 0.78,
key_type = "trigger",
node_id = "hand_left",
easing = "linear",
data = "animation_blend/pink_hand_open",
start_data = "animation_blend/pink_hand_closed",
property_id = "texture",
},
{
start_time = 0.78,
key_type = "trigger",
node_id = "hand_right",
easing = "linear",
data = "animation_blend/pink_hand_open",
start_data = "animation_blend/pink_hand_closed",
property_id = "texture",
},
},
},
{
animation_id = "idle",
duration = 3,
animation_keys = {
{
duration = 0.75,
key_type = "tween",
node_id = "body",
easing = "outsine",
end_value = 0.98,
start_value = 1,
property_id = "scale_y",
},
{
duration = 0.75,
key_type = "tween",
node_id = "body",
easing = "outsine",
end_value = 1.02,
start_value = 1,
property_id = "scale_x",
},
{
duration = 1.37,
key_type = "tween",
node_id = "body",
easing = "outsine",
start_value = 1.02,
end_value = 0.98,
start_time = 0.75,
property_id = "scale_x",
},
{
duration = 1.37,
key_type = "tween",
node_id = "body",
easing = "outsine",
start_value = 0.98,
end_value = 1.02,
start_time = 0.75,
property_id = "scale_y",
},
{
duration = 0.88,
key_type = "tween",
node_id = "body",
easing = "outsine",
start_value = 0.98,
end_value = 1,
start_time = 2.12,
property_id = "scale_x",
},
{
duration = 0.88,
key_type = "tween",
node_id = "body",
easing = "outsine",
start_value = 1.02,
end_value = 1,
start_time = 2.12,
property_id = "scale_y",
},
},
},
},
metadata = {
gui_path = "/example/examples/panthera/animation_blend/animation_blend.gui",
gizmo_steps = {
},
layers = {
},
fps = 60,
settings = {
font_size = 40,
},
},
nodes = {
},
},
version = 1,
type = "animation_editor",
format = "json",
}