Presenting

Fragments

Fragments make content appear one step at a time. fragment=True on add_title, add_content, or add_card reveals the whole item, and fragment_items reveals the items of a list one by one. A string picks the effect. Click the deck below, then press the right arrow.

from markdown import markdown
from respysive import Presentation, Slide

slide = Slide()
slide.add_title("Three steps to a standardised rate")
slide.add_content(
    [markdown("- Count the deaths by age group\n- Divide by the population of each group\n"
              "- Weight the rates by a reference population")],
    fragment_items="fade-up",
)
slide.add_content(["The result no longer depends on the age structure."], fragment="highlight-red")

deck = Presentation()
deck.add_slide([slide])
deck.save_html("fragments.html", theme="sober")
Click the slide, then use the arrow keys.

The effects are fade-up, fade-down, fade-left, fade-right, fade-out, semi-fade-out, grow, shrink, strike, highlight-red, highlight-green, highlight-blue, and current-visible.

In raw HTML, the fragment class does the same, and Reveal.js layout classes are supported: r-stack places its children on top of each other (to swap two blocks), r-hstack and r-vstack line them up, and r-fit-text sizes a line of text to the width of its container. Fragments, notes, and vertical slides swaps two charts this way.

Vertical slides

A list inside the list of slides makes a vertical stack: the first slide is on the main row and the others are reached with the down arrow. This suits details kept for questions.

from respysive import Presentation, Slide

def slide(title, text):
    s = Slide(center=True)
    s.add_title(title, tag="h2")
    s.add_content([text])
    return s

deck = Presentation()
deck.add_slide([
    slide("Introduction", "Right arrow: next topic."),
    [slide("Result", "Down arrow: the method."), slide("Method", "Up arrow: back to the result.")],
    slide("Conclusion", "Esc shows the overview of the whole deck."),
])
deck.save_html("vertical.html", theme="sober")
Click the slide, then use the arrow keys.

Speaker view

S opens a second window with the current slide, the next one, the notes, a clock, and a timer. A click on the timer resets it. Both windows stay in step, and either one can be used to move through the deck.