Add Noble.performTransition() to play a transition without changing scenes - #95
Open
ericlewis wants to merge 4 commits into
Open
Add Noble.performTransition() to play a transition without changing scenes#95ericlewis wants to merge 4 commits into
ericlewis wants to merge 4 commits into
Conversation
…cenes. (upstream issue NobleRobot#82) Implements upstream issue NobleRobot#82. Noble.performTransition(__duration, __transition, __transitionProperties) plays a transition animation while the current scene stays loaded and active: the scene's exit(), finish(), enter(), and start() methods are not called, and no new scene is created. User input is disabled when the transition starts and the current scene's inputHandler is restored when it completes, without re-running start(). Transitions now also accept per-invocation callback properties (onStart, onMidpoint, onHoldTimeElapsed, onComplete) in the transition properties table, which shadow the transition's callback methods for that invocation only. This enables the headline use case: dip to black, mutate the current scene at the midpoint while the screen is obscured, then dip back. Existing Noble.transition() behavior is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Noble.performTransition() completed by setting the input handler to currentScene.inputHandler, discarding whatever handler was actually active when the transition started. Games that manage input separately from the scene (a documented Noble.Input use-case, e.g. a modal menu handler set via Noble.Input.setHandler()) would silently lose their active handler; since NobleScene.inputHandler defaults to an empty table, all input appeared to stop working. It also re-enabled input that had been deliberately disabled via Noble.Input.setEnabled(false). Capture the active handler in Noble.transitionStartHandler() and restore exactly that in Noble.transitionCompleteHandler(), matching the documented contract that the current scene "stays loaded and remains the active scene." Refs upstream issue NobleRobot#82. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…Complete(). The onComplete closure in Noble.Transition:execute() ran the transition's onComplete() callback before Noble.transitionCompleteHandler(), so isTransitioning was still true inside user code. With the new per-invocation callback properties added in 50be77b, chaining a transition from onComplete - the natural use of that feature - hit the "You can't start a transition in the middle of another transition" guard and was silently dropped. Call the engine handler first, matching the ordering already used by the onStart and onMidpoint closures, so the transition state is fully cleared when user code runs. Refs upstream issue NobleRobot#82. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e generated docs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
✅ Deploy Preview for cheery-choux-736619 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #82.
Adds
Noble.performTransition(__duration, __transition, __transitionProperties): plays a transition animation while the current scene stays loaded and active. The scene'sexit(),finish(),enter(), andstart()methods are not called, and no new scene is created. User input is disabled when the transition starts, and the input handler that was active at that moment is restored when it completes (rather than assumingcurrentScene.inputHandler— games that manage input separately from the scene, a documentedNoble.Inputuse case, keep their handler).Transitions also now accept per-invocation callback properties (
onStart,onMidpoint,onHoldTimeElapsed,onComplete) in the transition properties table, which shadow the transition's callback methods for that invocation only. This enables the headline use case from #82: dip to black, mutate the current scene at the midpoint while the screen is obscured, then dip back:One ordering fix that this feature surfaced: the
onCompleteclosure inNoble.Transition:execute()ran the transition'sonComplete()callback beforeNoble.transitionCompleteHandler(), soisTransitioningwas still true inside user code — chaining a transition fromonComplete(the natural use of the new callbacks) hit the "You can't start a transition in the middle of another transition" guard and was silently dropped. The engine handler now runs first, matching the ordering already used by theonStartandonMidpointclosures.Existing
Noble.transition()behavior is unchanged. The generated docs pages for the new API are included (hand-patched HTML — happy to regenerate with LDoc instead if you prefer).🤖 Generated with Claude Code