Skip to content

Add Noble.performTransition() to play a transition without changing scenes - #95

Open
ericlewis wants to merge 4 commits into
NobleRobot:mainfrom
ericlewis:feature/perform-transition
Open

Add Noble.performTransition() to play a transition without changing scenes#95
ericlewis wants to merge 4 commits into
NobleRobot:mainfrom
ericlewis:feature/perform-transition

Conversation

@ericlewis

Copy link
Copy Markdown

Closes #82.

Adds 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 input handler that was active at that moment is restored when it completes (rather than assuming currentScene.inputHandler — games that manage input separately from the scene, a documented Noble.Input use 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:

Noble.performTransition(1.5, Noble.Transition.DipToBlack, {
	onMidpoint = function()
		-- rearrange the scene while the screen is black
	end
})

One ordering fix that this feature surfaced: the onComplete closure in Noble.Transition:execute() ran the transition's onComplete() callback before Noble.transitionCompleteHandler(), so isTransitioning was still true inside user code — chaining a transition from onComplete (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 the onStart and onMidpoint closures.

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

ericlewis and others added 4 commits August 11, 2026 05:57
…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>
@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for cheery-choux-736619 ready!

Name Link
🔨 Latest commit ed251de
🔍 Latest deploy log https://app.netlify.com/projects/cheery-choux-736619/deploys/6a7af309d1e04c00090d1f98
😎 Deploy Preview https://deploy-preview-95--cheery-choux-736619.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Play transition animation without changing/reloading scene

1 participant