diff --git a/docsrc/nimconf2022.nim b/docsrc/nimconf2022.nim
index 63092ac..acf45e9 100644
--- a/docsrc/nimconf2022.nim
+++ b/docsrc/nimconf2022.nim
@@ -701,7 +701,7 @@ slide:
nbCodeDontRunAnimate(1, 2, 3, 4..7, 9, 10, 11):
for n in [50, 100, 1000, 10000]:
let filename = &"images/gauss-{n}.png"
- let samples = newSeqWith[float](n, gauss(0.0, 1.0))
+ let samples = newSeqWith(n, gauss(0.0, 1.0))
let df = toDf(samples)
ggplot(df, aes("samples")) +
geom_histogram(fillColor="green") +
@@ -714,7 +714,7 @@ slide:
slide:
for n in [50, 100, 1000, 10000]:
let filename = &"images/gauss-{n}.png"
- let samples = newSeqWith[float](n, gauss(0.0, 1.0))
+ let samples = newSeqWith(n, gauss(0.0, 1.0))
let df = toDf(samples)
ggplot(df, aes("samples")) +
geom_histogram(fillColor="green") +
@@ -738,4 +738,4 @@ slide:
nbText: "Thanks for watching 😄"
nbText: "Have a great day!"
-nbSave()
\ No newline at end of file
+nbSave()
diff --git a/src/nimiSlides.nim b/src/nimiSlides.nim
index a0e8802..d5a7097 100644
--- a/src/nimiSlides.nim
+++ b/src/nimiSlides.nim
@@ -31,6 +31,18 @@ type
SlidesTheme* = enum
Black, Beige, Blood, Dracula, League, Moon, Night, Serif, Simple, Sky, Solarized, White
+ SlideTransition* {.pure.} = enum
+ none = "none"
+ slide = "slide" # default
+ fade = "fade"
+ convex = "convex"
+ concave = "concave"
+ zoom = "zoom"
+
+ SlideTransitionSpeed* {.pure.} = enum
+ fast = "fast"
+ slow = "slow"
+
Corner* = enum
UpperLeft, UpperRight, LowerLeft, LowerRight
@@ -38,6 +50,9 @@ type
localReveal*: string
SlideOptions* = object
+ transition*: SlideTransition
+ outTransition*: SlideTransition
+ transitionSpeed*: SlideTransitionSpeed
autoAnimate*: bool
colorBackground*: string
imageBackground*: string
@@ -46,12 +61,12 @@ type
iframeInteractive*: bool
gradientBackground*: string
-proc slideOptions*(autoAnimate = false, iframeInteractive = true, colorBackground, imageBackground, videoBackground, iframeBackground, gradientBackground: string = ""): SlideOptions =
+proc slideOptions*(autoAnimate = false, iframeInteractive = true, colorBackground, imageBackground, videoBackground, iframeBackground, gradientBackground: string = "", transition = SlideTransition.slide, outTransition = transition, transitionSpeed = SlideTransitionSpeed.fast ): SlideOptions =
SlideOptions(
autoAnimate: autoAnimate, iframeInteractive: iframeInteractive, colorBackground: colorBackground,
imageBackground: imageBackground, videoBackground: videoBackground,
iframeBackground: iframeBackground,
- gradientBackground: gradientBackground,
+ gradientBackground: gradientBackground, transition: transition, outTransition: outTransition, transitionSpeed: transitionSpeed
)
const reveal_version* = "5.0.4"
@@ -217,6 +232,8 @@ var currentFragment*, currentSlideNumber*: int
proc slideOptionsToAttributes*(options: SlideOptions): string =
result.add """data-nimib-slide-number="$1" """ % [$currentSlideNumber]
+ result.add """data-transition="$1-in $2-out" """ % [$options.transition, $options.outTransition]
+ result.add """data-transition-speed="$1" """ % [$options.transitionSpeed]
if options.autoAnimate:
result.add "data-auto-animate "
if options.colorBackground.len > 0:
@@ -511,6 +528,13 @@ template bigText*(text: string) =
template fitImage*(src: string) =
nbRawHtml: hlHtml"""
""" % [src]
+template fitVideo*(src: string) =
+ nbRawHtml: """
+""" % [src]
+
template speakerNote*(text: string) =
nbRawHtml: """