Tap the example to change scene.
Fade to black between the title screen and the game.
View code
game.transitionTo(levelScene, { type: "fade", color: "#000000", durationMs: 700 });
Move between the title, the level, and the game-over screen with a transition instead of a jump cut.
Try each example, then copy the words under it and paste them to your AI. You can also send your AI the link to an example.
Calm transitions that suit menus and the start of a level.
Tap the example to change scene.
Fade to black between the title screen and the game.
game.transitionTo(levelScene, { type: "fade", color: "#000000", durationMs: 700 });
Tap the example to change scene.
Slide to the next level from right to left.
game.transitionTo(nextLevel, { type: "slide", direction: "right-to-left", durationMs: 700 });
Tap the example to change scene.
Change to the results screen with a wipe from left to right.
game.transitionTo(resultsScene, { type: "wipe", direction: "left-to-right", durationMs: 700 });
Transitions with character, for winning, losing, or entering a new world.
Tap the example to change scene.
When the level ends, close a circle on the player and open it on the next level.
game.transitionTo(nextLevel, { type: "iris", centerX: player.x, centerY: player.y, durationMs: 700 });
Tap the example to change scene.
Pixelate the screen when the player enters a new world.
game.transitionTo(newWorld, { type: "pixelate", pixelSize: 32, durationMs: 700 });
Tap the example to change scene.
Flash the screen white when the player loses and show the game-over screen.
game.transitionTo(gameOverScene, { type: "flash", color: "#ffffff", durationMs: 700 });
How a long game keeps its first wait short.
A game with many levels can download each level's pictures when the player gets there, instead of all of them before the game starts.
This is worth it only when a game has many levels and each one has lots of pictures of its own: the game starts sooner, and a level nobody reaches is never downloaded. While the next level loads, the current screen pauses and dims under a small ring that fills up, and then the transition plays. A game with a few scenes should load everything at the start, which is what your AI does when you do not ask.
The game has many levels, each with its own backgrounds and enemies; load each level's pictures only when the player reaches it.