-
-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transitions for bespoke template #447
Comments
Is this transition can used for vscode extention? |
@tianfanghan Not yet. Please read "Status in Marp ecosystem" section.
|
Hi yhatt, I just wanted to say a big thank you to you and the team for this long awaited transition feature! I've tried in Ubuntu and Arch Linux and it works like a charm with the provided instructions and the downloaded marp-cli binary. Great work :) |
This property is not referenced by bespoke transition plugin in reality, so (probably) there is nothing to worry about breaking transitions in exist slides. On the other hand, we may have to modify a defined type interface and unit testing. |
Thank you for all your work on this! Are there any plans to allow transitions such as "fade" to also work with .pptx exports? |
Thanks for your feedback! We have thought that transition effects can be applied to PPTX if Markdown is using the built-in effect that is compatible with PPTX. Actually I have already tried the implementation for getting transition effects in PDF, and worked well. However, I've postponed PDF transition effects due to lacked support in Acrobat Reader for Mac At this moment, it's difficult to implement transition effects to PPTX shortly, because PptxGenJS (a presentation generation library Marp is using) has no support about slide transitions, and I'm not familiar with a specification of PPTX file format. If received more feedbacks, we consider to work on the transition support for other file formats. Of course, we are welcome to contribute from community. |
Expreimental transitions are available in Marp CLI v2.3.0 and later + Google Chrome 109 and later.
This issue is for tracking an experimental transitions support for bespoke template, and the content may change actively. Welcome your feedback about this experiment!
See "Guide" section of this issue for how to use transitions experiment. ⬇️
Quick look
marp-cli-experimental-transition-showcase.mp4
Try this command to preview transitions on Marp CLI:
Gist: https://gist.github.com/yhatt/d9e86ee53eb8816aaf9c996e773b6f82
Background
A slide transition is a very common feature in several full-featured presentation tools. However, handling transition tends to become complex due to rendering 2 pages while performing transitions.
We believe that holding a complex logic makes hard to maintain the ecosystem, and will bring burnout eventually as like as a classic app. So we had ever not worked on transitions for Marp.
But it becomes a different story if provided a simple solution by the browser. View Transitions API proposal provides a simple and high-level API for transition animations.
By using this proposal, transitions for Marp CLI bespoke template can get both of effective transitions for Marp slides and the ecosystem sustainability.
Helpful resources to know API
Guide
Prerequisite
The experimental transition feature is relied on View Transitions API proposal. It is still proposal and not generally available in the most of browsers at this time.
This API requires Chrome 109 and later, with enabled
viewTransition API
experiment (chrome://flags/#view-transition
).You can try experimental transitions easily by using Marp CLI preview window (
--preview
). The preview window will turn on a depending experiment automatically.Enable experimental transitions
Add
--bespoke.transition
option.The transition feature is bespoke template specific so it would not work in non-HTML format and other templates like
bare
template.transition
local directiveTo use transition animations, you have to choose a transition effect for slide(s) by defining
transition
local directive in your Markdown.As same as other local directives like
header
andclass
, you can change the kind of transition in the middle of slides by defining thetransition
directive through HTML comment, or apply a specific transition into a single slide by using a scoped local directive (_transition
: as known as spot directive).Built-in effects
clockwise
counterclockwise
cover
coverflow
cube
cylinder
diamond
drop
explode
fade
fade-out
fall
flip
glow
implode
in-out
iris-in
iris-out
melt
overlap
pivot
pull
push
reveal
rotate
slide
star
swap
swipe
swoosh
wipe
wiper
zoom
Check the video at the top section of this issue.
You also can turn off the transition effect by setting
none
.Set custom duration
The default duration of transition is 0.5s in all transitions, but you can set custom duration by adding a space-separated parameter to
transition
directive definition.Custom duration should have a unit
s
orms
.Custom transition 🌠
In the second iteration of transition experiment, you can define the custom transition through CSS. You can make your own transition effect just by declaring animation keyframes.
This is very exciting and so creative feature! We are using exist CSS
@keyframes
declarations and never adding Marp specific syntax to CSS, so there should be no CSS complexity losing too. You also can tweak animation of built-in transitions by overloading keyframes.We are really looking forward to what creative transitions our community will create!!
➡️ See blog article: "Marp CLI Experimental: How to make custom transition"
Features from View Transitions proposal
Transition with shared elements
By using
view-transition-name
CSS property, you can make the specific elements move individually during transition, just like as PowerPoint Morph and Keynote Magic Move.In a below example, the first
<h1>
element in each slide page and the image<img>
that hasshared
space-separated keyword inalt
attribute are marked as shared elements while transition. If there were a pair of same named elements in the outgoing slide and incoming slide, these will have a morph animation during transition.Currently
contain: paint;
is also required to work the morph animation.Please note that the named element should have determined uniquely per slides. If there are multiple elements with the same name in a single slide, the whole of transition animation will fail due to the runtime error.
For marking
view-transition-name
with more flexibility, you can also use the<span>
element with a custom class by enabling HTML tag rendering through--html
option.Spec: https://www.w3.org/TR/css-view-transitions-1/#view-transition-name-prop
Opt-out transitions
Of course, not everyone is fun of dizzy animation from a transition effect. Transitions in the presentation often may have too much movings, and someone may feel it like as motion sickness.
So we respect
prefers-reduced-motion
media query in the converted HTML, to be able to make the slide viewer opt-out transition animations. If a user preference in response toprefers-reduced-motion
has set, all kind of transitions are forced to a constant dissolve effect as same asfade
built-in transition. Shared elements defined by the author have no animations too.Status in Marp ecosystem
In Marp CLI,
--bespoke.transition
is going to keep experimental and optional until View Transitions API proposal makes stable and generally available in at least one of major browsers.If become stable, we are going to add support of transitions for downstream tools too. (e.g. auto-complete of
transition
directive in Marp for VS Code)Known topics
[enhancement] A local-scoped keyframes set by<style scoped>
cannot use as transition keyframes.<style scoped>
#456Changelog
See #382 to see about previous iteration.
The text was updated successfully, but these errors were encountered: