HugoGranstrom / nimiSlides

A Reveal.js theme for nimib for making slideshow presentations in Nim
https://hugogranstrom.com/nimiSlides
MIT License
78 stars 5 forks source link

Auto-animation API #40

Closed HugoGranstrom closed 5 months ago

HugoGranstrom commented 7 months ago

Closes #38

The proposed API is:

autoAnimateSlides(5):
    showOn(1, 2, 3):
      nbText: "1, 2, 3"

    nbText: "Always"

    showOn(3, 4, 5):
      nbText: "3, 4, 5"

You pass the total number of slides you want to auto-animate to autoAnimateSlides and then each showOn will only be shown on the slides it number. In this case the first nbText will be shown for the first three slides and the last one will be shown only on the last three slides. And it all auto-animates!

Still left todo:

pietroppeter commented 7 months ago

Nice API!

HugoGranstrom commented 7 months ago

Thanks, the names of the templates are up for grab though. showOn feels a bit off IMO

pietroppeter commented 7 months ago

I do not mind showOn, you could also have a showFrom (or showSince) and showUntil (where you give the last index. Or a difference set could be showBefore, showAfter, showAt

HugoGranstrom commented 7 months ago

Those are good names, thanks 😁 There are a lot of small details like this to consider. Should it be zero indexed (like Nim) or 1 index (like the rows in animateCode)? Should we use inclusive or exclusive variants of the templates? I think inclusive, 1-indexed makes the most sense in this case. What is your take on this?

HugoGranstrom commented 7 months ago

This is really sweet actually, the example above became the more readable:

autoAnimateSlides(5):
  showUntil(3):
    nbText: "1, 2, 3"
  nbText: "Always"
  showFrom(3):
    nbText: "3, 4, 5"
pietroppeter commented 7 months ago

yep, inclusive and 1-indexed looks a good choice to me.

HugoGranstrom commented 5 months ago

I've finally written the the docs. I will proably have another go at supporting other blocks in the future but this is good enough for now.