feat: This enables user-defined transition and uses a tween to animate the transitions (#405)
* feat: This enables user-defined transition and uses a tween to animate the transitions fixes #344 * docs: Automatic update of API docs * docs: Automatic update of API docs Co-authored-by: Dennis Ploeger <develop@dieploegers.de> Co-authored-by: dploeger <dploeger@users.noreply.github.com>
This commit is contained in:
@@ -63,7 +63,10 @@ func run(command_params: Array) -> int:
|
||||
escoria.event_manager.interrupt_running_event()
|
||||
|
||||
if !command_params[1]:
|
||||
escoria.main.scene_transition.transition_out()
|
||||
escoria.main.scene_transition.transition(
|
||||
"",
|
||||
ESCTransitionPlayer.TRANSITION_MODE.OUT
|
||||
)
|
||||
yield(escoria.main.scene_transition, "transition_done")
|
||||
|
||||
escoria.inputs_manager.clear_stack()
|
||||
@@ -109,7 +112,7 @@ func run(command_params: Array) -> int:
|
||||
return rc[0]
|
||||
|
||||
if !command_params[1]:
|
||||
escoria.main.scene_transition.transition_in()
|
||||
escoria.main.scene_transition.transition()
|
||||
yield(escoria.main.scene_transition, "transition_done")
|
||||
|
||||
if script.events.has("ready"):
|
||||
@@ -122,7 +125,7 @@ func run(command_params: Array) -> int:
|
||||
|
||||
else:
|
||||
if !command_params[1]:
|
||||
escoria.main.scene_transition.transition_in()
|
||||
escoria.main.scene_transition.transition()
|
||||
yield(escoria.main.scene_transition, "transition_done")
|
||||
|
||||
# Clear queued resources
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
# `transition transition_name in|out`
|
||||
# `transition transition_name in|out [delay]`
|
||||
#
|
||||
# Performs a transition in our out manually.
|
||||
#
|
||||
# Parameters:
|
||||
# - transition_name: Name of the transition shader from one of the transition
|
||||
# directories
|
||||
# - in|out: Wether to play the transition in IN- or OUT-mode
|
||||
# - delay: Delay for the transition to take. Defaults to 1 second
|
||||
#
|
||||
# @ESC
|
||||
extends ESCBaseCommand
|
||||
class_name TransitionCommand
|
||||
@@ -11,8 +17,8 @@ class_name TransitionCommand
|
||||
func configure() -> ESCCommandArgumentDescriptor:
|
||||
return ESCCommandArgumentDescriptor.new(
|
||||
2,
|
||||
[TYPE_STRING, TYPE_STRING],
|
||||
[null, null]
|
||||
[TYPE_STRING, TYPE_STRING, TYPE_REAL],
|
||||
[null, null, 1.0]
|
||||
)
|
||||
|
||||
|
||||
@@ -39,7 +45,14 @@ func validate(arguments: Array):
|
||||
|
||||
# Run the command
|
||||
func run(command_params: Array) -> int:
|
||||
var transition_player = escoria.main.scene_transition
|
||||
transition_player.call("transition_%s" % command_params[1], command_params[0])
|
||||
var animation_finished = yield(transition_player, "transition_done")
|
||||
escoria.main.scene_transition.transition(
|
||||
command_params[0],
|
||||
ESCTransitionPlayer.TRANSITION_MODE.OUT if command_params[1] == "out" \
|
||||
else ESCTransitionPlayer.TRANSITION_MODE.IN,
|
||||
command_params[2]
|
||||
)
|
||||
yield(
|
||||
escoria.main.scene_transition,
|
||||
"transition_done"
|
||||
)
|
||||
return ESCExecution.RC_OK
|
||||
|
||||
Reference in New Issue
Block a user