Skip to content

feat: a theme can change slides in a view transition - #16

Open
victorbahl wants to merge 1 commit into
roaldnefs:mainfrom
victorbahl:feat/slide-transitions
Open

victorbahl wants to merge 1 commit into
roaldnefs:mainfrom
victorbahl:feat/slide-transitions

Conversation

@victorbahl

Copy link
Copy Markdown
Contributor

Hey Roald, another small one: a theme can animate the change of slide.

A theme that sets --slide-transition on :root has the show change slides in a view transition, typed forward or backward. The engine only starts it, the theme says what it looks like. This is the dissolve I added to the default theme, switched off:

:root{--slide-transition:none} /* or dissolve */
::view-transition-old(root){animation:none}
::view-transition-new(root){animation:.45s ease both dissolve}
@keyframes dissolve{from{opacity:0}}
  • The default theme has it at none, so nothing changes until a deck asks for it. The slide on theme tokens mentions it.
  • Not in the edit view, the presenter's panes or print, nor for reduced motion. A browser without typed view transitions changes the slide at once.
  • It's in the engine because only the engine knows when a slide changes.

With a transition on, .current moves to the new slide just after the key press rather than during it, as the browser takes its picture of the old slide first.

npm test: 13 node tests and 107 browser tests pass, one of them new.

A theme that sets --slide-transition on :root has the show change slides
in a view transition, typed forward or backward, and animates it. Not in
the edit view, the presenter's panes or print, nor for reduced motion. A
browser without typed view transitions changes the slide at once.

The default theme has a dissolve, off until --slide-transition is set to it.

This branch has not been deployed

No deployments
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.

1 participant