writing / 05 of 13
Transitions
Each slide names the animation that brings it on screen. kyma draws it in the terminal frame by frame, sixty times a second, driven by a spring.
The nine transitions
Set one with transition: in a slide’s front matter.
| name | what you see | going back plays | length |
|---|---|---|---|
none |
A cut. The next slide is simply there. | none |
– |
swipeLeft |
The current slide leaves to the left as the next one comes in from the right. | swipeRight |
~530 ms |
swipeRight |
The next slide comes in from the left, pushing the current one out to the right. | swipeLeft |
~530 ms |
slideUp |
The current slide is pushed up and the next rises from the bottom edge. | slideDown |
~600 ms |
slideDown |
The current slide is pushed down and the next drops in from the top. | slideUp |
~600 ms |
flip |
The next slide is uncovered from the left while the current one is squeezed into the shrinking space on the right. | flip |
~600 ms |
collapse |
A band in the middle of the current slide narrows to nothing as the next slide closes in from both edges. | expand |
~400 ms |
expand |
The next slide grows out of a band in the middle, over the current one. | collapse |
~400 ms |
fade |
The slides dissolve into each other in 2×2-cell tiles. The tiles go in the same order every time. | fade |
~200 ms |
The lengths are frames at 60 a second: 32 for the swipes, 36 for slides and flip, 24 for collapse and expand, 12 for fade. They don’t change with the terminal’s size. A large or slow terminal adds its own drawing time on top.
--- transition: swipeLeft --- ## Slides are markdown Separate them with four dashes. Front matter picks the transition.
Κῦμα: a wave, a billow, a surge.
Presentations from markdown.
Going backwards
A transition belongs to the slide it brings in. Going forward onto slide 4 plays slide 4’s transition. Going back from slide 4 to slide 3 plays the opposite of slide 4’s transition. A swipeLeft comes back as a swipeRight, a collapse as an expand.
Slide 3’s own transition plays only when you arrive at it going forward.
Only the next and previous keys animate. The command palette, go to slide, jump, and the first and last slide keys all cut straight to the slide. While a transition is running, next and previous are ignored until it lands.
How it’s drawn
For every frame kyma renders both slides in full, the one leaving and the one arriving, and cuts them together line by line. So a transition carries whatever the slides hold, including colours, code and grids.
A spring moves the cut, stepped once per frame, and kyma stops on the first frame that reaches the end. That gives each transition a fast start that eases into place without overshooting.
Choosing one
A deck reads calmer with one transition doing most of the work. A sideways swipe suits a run of slides that follow on from each other. slideUp works as a change of section, and fade, the shortest, keeps out of the way. Save flip, collapse and expand for the moments you want noticed.