forked from LeenkxTeam/Leenkx_Examples
update
This commit is contained in:
0
animation_blend/Bundled/canvas/MyCanvas.files
Normal file
0
animation_blend/Bundled/canvas/MyCanvas.files
Normal file
1
animation_blend/Bundled/canvas/MyCanvas.json
Normal file
1
animation_blend/Bundled/canvas/MyCanvas.json
Normal file
@ -0,0 +1 @@
|
||||
{"name":"untitled","x":0,"y":0,"width":1280,"height":720,"elements":[{"id":0,"type":0,"name":"Text","event":"","x":0,"y":0,"width":383,"height":44,"rotation":0,"text":"Hold W/S to blend","asset":"","color":-1,"anchor":0,"parent":null,"children":[],"visible":true}],"assets":[],"theme":"Default Light"}
|
||||
1
animation_blend/Bundled/canvas/_themes.json
Normal file
1
animation_blend/Bundled/canvas/_themes.json
Normal file
@ -0,0 +1 @@
|
||||
[{"NAME":"Default Light","WINDOW_BG_COL":-1052689,"WINDOW_TINT_COL":-14540254,"ACCENT_COL":-1118482,"ACCENT_HOVER_COL":-4473925,"ACCENT_SELECT_COL":-5592406,"BUTTON_COL":-3355444,"BUTTON_TEXT_COL":-14540254,"BUTTON_HOVER_COL":-5000269,"BUTTON_PRESSED_COL":-5131855,"TEXT_COL":-14144472,"LABEL_COL":-5592406,"SEPARATOR_COL":-6710887,"HIGHLIGHT_COL":-14656100,"CONTEXT_COL":-5592406,"PANEL_BG_COL":-5592406,"FONT_SIZE":26,"ELEMENT_W":200,"ELEMENT_H":48,"ELEMENT_OFFSET":8,"ARROW_SIZE":10,"BUTTON_H":44,"CHECK_SIZE":30,"CHECK_SELECT_SIZE":16,"SCROLL_W":12,"TEXT_OFFSET":16,"TAB_W":24,"FILL_WINDOW_BG":false,"FILL_BUTTON_BG":true,"FILL_ACCENT_BG":false,"LINK_STYLE":0,"FULL_TABS":false}]
|
||||
1
animation_blend/README.md
Normal file
1
animation_blend/README.md
Normal file
@ -0,0 +1 @@
|
||||
Hold keyboard `W`, `S` to blend between animations
|
||||
30
animation_blend/Sources/lnx/MyTrait.hx
Normal file
30
animation_blend/Sources/lnx/MyTrait.hx
Normal file
@ -0,0 +1,30 @@
|
||||
package lnx;
|
||||
|
||||
class MyTrait extends iron.Trait {
|
||||
|
||||
var factor = 0.0;
|
||||
|
||||
public function new() {
|
||||
super();
|
||||
|
||||
notifyOnUpdate(function() {
|
||||
|
||||
var anim:iron.object.BoneAnimation = cast object.children[0].animation;
|
||||
var kb = iron.system.Input.getKeyboard();
|
||||
|
||||
// Blend idle and run actions
|
||||
// factor 0.0 -> 100% idle
|
||||
// factor 0.5 -> 50% idle, 50% run
|
||||
// factor 1.0 -> 100% run
|
||||
if (kb.down("w")) {
|
||||
if (factor <= 0.99) factor += 0.01;
|
||||
anim.blend("idle", "run", factor);
|
||||
}
|
||||
|
||||
if (kb.down("s")) {
|
||||
if (factor >= 0.01) factor -= 0.01;
|
||||
anim.blend("idle", "run", factor);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
BIN
animation_blend/animation_blend.blend
Normal file
BIN
animation_blend/animation_blend.blend
Normal file
Binary file not shown.
Reference in New Issue
Block a user