03.09 · Page Transitions

Elastic Transition

The new page slides in, goes too far and springs back. Best for playful apps.

Click it

Click Work or About at the top of the box, or press Show me.

Try it

Change a setting, then try it again or press Show me.

How it bounces

A planned path is cheap; a live spring feels more physical.

Bounce size

How far the page goes past its place before settling.

Speed

How quickly the page springs into place.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add an elastic transition to [the pages or panels you want to move between]. The new page should slide in from the side, go a little past its place and spring back before settling, as if pulled by a rubber band, while the old page slides away. The bounce can be planned ahead as a fixed path, which is cheap, or worked out live with a simple spring, which can react if the visitor interrupts it; with a live spring, advance it in small fixed time steps so it moves the same on every screen, and limit the time one frame adds so a slow frame cannot throw it off. If the visitor has reduced motion turned on, switch pages without movement. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Playful apps
  • Panels and drawers
  • Games

Avoid on

  • Formal sites