Skip to content

Commit

Permalink
auto-animate example in demo
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed May 19, 2020
1 parent 815557c commit 9d11927
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 29 deletions.
49 changes: 49 additions & 0 deletions css/layout.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Layout helpers.
*/

// Stretch an element vertically based on available space
.reveal .stretch,
.reveal .r-stretch {
max-width: none;
max-height: none;
}

.reveal pre.stretch code,
.reveal pre.r-stretch code {
height: 100%;
max-height: 100%;
box-sizing: border-box;
}

// Stack multiple elements on top of each other
.reveal .r-stack {
display: grid;
}

.reveal .r-stack > * {
grid-area: 1/1;
margin: auto;
}

// Horizontal and vertical stacks
.reveal .r-vstack,
.reveal .r-hstack {
display: flex;
}

.reveal .r-vstack {
flex-direction: column;
}

.reveal .r-hstack {
flex-direction: row;
}

.reveal .items-center {
align-items: center;
}

.reveal .justify-center {
justify-content: center;
}
25 changes: 1 addition & 24 deletions css/reveal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Copyright (C) Hakim El Hattab, https://hakim.se
*/

@import 'layout';

/*********************************************
* GLOBAL STYLES
Expand Down Expand Up @@ -213,30 +214,6 @@ html.reveal-full-page {
position: relative;
}

// Layout helper: Stretch an element vertically based on available space
.reveal .stretch,
.reveal .r-stretch {
max-width: none;
max-height: none;
}

.reveal pre.stretch code,
.reveal pre.r-stretch code {
height: 100%;
max-height: 100%;
box-sizing: border-box;
}

// Layout helper: Stack multiple elements on top of each other
.reveal .r-stack {
display: grid;
}

.reveal .r-stack > * {
grid-area: 1/1;
margin: auto;
}


/*********************************************
* CONTROLS
Expand Down
26 changes: 26 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,32 @@ <h2>Point of View</h2>
</p>
</section>

<section data-auto-animate data-auto-animate-easing="cubic-bezier(0.770, 0.000, 0.175, 1.000)">
<h2>Auto-Animate</h2>
<p>Automatically animate matching elements across slides with <a href="https://revealjs.netlify.app/auto-animate/">Auto-Animate</a>.</p>
<div class="r-hstack justify-center">
<div data-id="box1" style="background: #999; width: 50px; height: 50px; margin: 10px; border-radius: 5px;"></div>
<div data-id="box2" style="background: #999; width: 50px; height: 50px; margin: 10px; border-radius: 5px;"></div>
<div data-id="box3" style="background: #999; width: 50px; height: 50px; margin: 10px; border-radius: 5px;"></div>
</div>
</section>
<section data-auto-animate data-auto-animate-easing="cubic-bezier(0.770, 0.000, 0.175, 1.000)">
<div class="r-hstack justify-center">
<div data-id="box1" data-auto-animate-delay="0" style="background: cyan; width: 150px; height: 100px; margin: 10px;"></div>
<div data-id="box2" data-auto-animate-delay="0.1" style="background: magenta; width: 150px; height: 100px; margin: 10px;"></div>
<div data-id="box3" data-auto-animate-delay="0.2" style="background: yellow; width: 150px; height: 100px; margin: 10px;"></div>
</div>
<h2 style="margin-top: 20px;">Auto-Animate</h2>
</section>
<section data-auto-animate data-auto-animate-easing="cubic-bezier(0.770, 0.000, 0.175, 1.000)">
<div class="r-stack">
<div data-id="box1" style="background: cyan; width: 300px; height: 300px; border-radius: 200px;"></div>
<div data-id="box2" style="background: magenta; width: 200px; height: 200px; border-radius: 200px;"></div>
<div data-id="box3" style="background: yellow; width: 100px; height: 100px; border-radius: 200px;"></div>
</div>
<h2 style="margin-top: 20px;">Auto-Animate</h2>
</section>

<section>
<h2>Touch Optimized</h2>
<p>
Expand Down
4 changes: 2 additions & 2 deletions dist/reveal.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/reveal.esm.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/reveal.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ gulp.task('serve', () => {
], gulp.series('css-themes'))

gulp.watch([
'css/reveal.scss',
'css/*.scss',
'css/print/*.{sass,scss,css}'
], gulp.series('css-core'))

Expand Down

0 comments on commit 9d11927

Please sign in to comment.