-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Right now auto-animation is quite verbose and repetitive. For example this simple example:
slide(slideOptions(autoAnimate=true)):
nbText: """
# Only title first
"""
slide(slideOptions(autoAnimate=true)):
nbText: """
# Only title first
Then both title and text!
"""
We had to repeat the # Only title first twice and if we ever need to update it in the future, we will have to remember to change it in both places! Let's try to DRY this down as much as we can! Here's a proposed API:
autoAnimateSlides(nSlides=2):
showOn({0, 1}):
nbText: "# Only title first"
showOn({1}):
nbText: "Then both title and text!
This will internally loop through the body nSlides times and only generate the showOns that match the current index.
This has its drawbacks though:
- All blocks will need to be recognized by Reveal.js as auto-animatable. You can't just wrap everything in a
<div>as I remember it. - This also means all blocks must insert a
data-idin the correct place, which means each block's partials must be modified! - It won't work well with text in
nbTextsplit over multiple calls. For examplenbText: "Hello world"is not splitable tonbText: "Hello"; nbText: "world". So a separate mechanism would have to be implemented for text innbText. Ideally, it should work with theautoAnimateSlidesabove. Here we will probably have to use<span>.
I will probably start out with the nbText version, but I'm not sure how to do it yet. Either through some kind of templating, e.g. #%[0, 1][Hello] #%[1][world]. Where the indices and text is supplied. It is quite ugly, though.
The other option is a more programmatic approach:
nbTextAnimate(({0, 1}, "Hello"), ({1}, " world"))
This is arguably even uglier and less readable :/
If someone has any other idea for possible APIs I'm very happen to see hear about them :D