Skip to content

Commit 7d9d27e

Browse files
author
Martino
committed
v1.0.9
1 parent fe1381c commit 7d9d27e

File tree

5 files changed

+25
-23
lines changed

5 files changed

+25
-23
lines changed

demo.html

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
<h1 class="animated flipInX slow">Appearance</h1>
2424
<h3 class="animated flipInX slow" data-delay="700">for Reveal.js</h3>
2525
</section>
26-
<section class="center"><small>In Powerpoint you can make slides with items that appear automatically with effects. This plugin for Reveal.js tries to achieve the same result. It's easy to set up. It uses Animate.css by Daniel Eden for the animations, with some changes in a separate CSS file to allow for a non-animated state. </small><br><br><small>We do not want the animations to start during the slide transition, so we wait for the slide transition to end. Reveal versions lower than 4 have no "slidetransitionend" event, so we need the Transit.js plugin that handles that.</small>
27-
<p>Let's check out what appearance.js does:</p>
26+
<section class="center"><small>In Powerpoint you can make slides with items that appear automatically with effects. Appearance is a plugin for Reveal.js that does the same. </small><br><br><small>Appearance is easy to set up. It uses Animate.css by Daniel Eden for the animations, with some changes in a separate CSS file to allow for a non-animated state. </small>
27+
<p>Let's check out what Appearance does:</p>
2828
</section>
2929
<section class="center">
3030
<h3>Let text appear</h3>
@@ -71,10 +71,10 @@ <h3>Inside fragments</h3>
7171
</div>
7272
</section>
7373
<section class="center" data-auto-animate>
74-
<h3>Set the event for Appearance</h3>
74+
<h3>Change when Appearance starts</h3>
7575
</section>
76-
<section class="center" data-auto-animate>
77-
<h3>Set the event for Appearance</h3>
76+
<section class="center" data-auto-animate data-appearevent="auto">
77+
<h3>Change when Appearance starts</h3>
7878
<div>
7979
<p class="animated fadeInUp">You can use any of the following events:</p>
8080
</div>
@@ -83,9 +83,7 @@ <h3>Set the event for Appearance</h3>
8383
<li class="animated bounceInLeft"><em>slidechanged</em> (with the transition)</li>
8484
<li class="animated bounceInLeft"><em>auto</em> (with transition, on autoanimate slides)</li>
8585
</ul>
86-
<div>
87-
<p class="animated fadeInUp">This can also be set per-slide with data-attributes</p><small class="animated fadeInUp">Reveal forces opacity changes on unmatched autoanimate items, while Appearance does the same. To avoid getting animation stutter, make sure that your Appearance items are nested in a parent that does not use an animation class.</small>
88-
</div>
86+
<div><br><small class="animated fadeInUp">This can also be set per-slide with data-attributes.</small></div>
8987
</section>
9088
</section>
9189
<section class="center" data-transition="convex-in fade-out">
@@ -115,6 +113,13 @@ <h3>Thanks</h3>
115113
Reveal.initialize({
116114
transition: "convex",
117115
history: true,
116+
appearance: {
117+
baseclass: "animated",
118+
visibleclass: "in",
119+
hideagain: true,
120+
delay: 300,
121+
appearevent: "slidetransitionend"
122+
},
118123
plugins: [
119124
Appearance
120125
]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "reveal.js-appearance",
3-
"version": "1.0.8",
3+
"version": "1.0.9",
44
"description": "A plugin for Reveal.js 4 that adds appearance effects to elements",
55
"keywords": "reveal, reveal.js, reveal-plugin, plugin, text effects",
66
"homepage": "https://github.com/Martinomagnifico/reveal.js-appearance",

plugin/appearance/appearance.esm.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* https://github.com/Martinomagnifico
55
*
66
* Appearance.js for Reveal.js
7-
* Version 1.0.8
7+
* Version 1.0.9
88
*
99
* @license
1010
* MIT licensed
@@ -125,11 +125,11 @@ var Plugin = function Plugin() {
125125
var slides = fromTo(event);
126126

127127
if (slides.to.dataset.appearevent == "auto") {
128-
slides.to.dataset.appearevent == "autoanimate";
128+
slides.to.dataset.appearevent = "autoanimate";
129129
}
130130

131131
if (options.appearevent == "auto") {
132-
options.appearevent == "autoanimate";
132+
options.appearevent = "autoanimate";
133133
}
134134

135135
if (!slides.to.dataset.eventdone) {
@@ -154,8 +154,7 @@ var Plugin = function Plugin() {
154154
showAppearances(slides.to);
155155
slides.to.dataset.eventdone = true;
156156
} else if (event.type == 'overviewhidden') {
157-
document.body.dataset.exitoverview = true; // This hack is because Reveal does not give the correct clicked slide from the overviewhidden event
158-
157+
document.body.dataset.exitoverview = true;
159158
setTimeout(function () {
160159
document.body.removeAttribute('data-exitoverview');
161160
}, 500);

plugin/appearance/appearance.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* https://github.com/Martinomagnifico
55
*
66
* Appearance.js for Reveal.js
7-
* Version 1.0.8
7+
* Version 1.0.9
88
*
99
* @license
1010
* MIT licensed
@@ -131,11 +131,11 @@
131131
var slides = fromTo(event);
132132

133133
if (slides.to.dataset.appearevent == "auto") {
134-
slides.to.dataset.appearevent == "autoanimate";
134+
slides.to.dataset.appearevent = "autoanimate";
135135
}
136136

137137
if (options.appearevent == "auto") {
138-
options.appearevent == "autoanimate";
138+
options.appearevent = "autoanimate";
139139
}
140140

141141
if (!slides.to.dataset.eventdone) {
@@ -160,8 +160,7 @@
160160
showAppearances(slides.to);
161161
slides.to.dataset.eventdone = true;
162162
} else if (event.type == 'overviewhidden') {
163-
document.body.dataset.exitoverview = true; // This hack is because Reveal does not give the correct clicked slide from the overviewhidden event
164-
163+
document.body.dataset.exitoverview = true;
165164
setTimeout(function () {
166165
document.body.removeAttribute('data-exitoverview');
167166
}, 500);

plugin/appearance/plugin-src.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const Plugin = () => {
66

77
const appear = function (deck, options) {
88

9-
109
const debugLog = function(text) {
1110
if (options.debug) console.log(text);
1211
}
@@ -67,8 +66,8 @@ const Plugin = () => {
6766

6867
let slides = fromTo(event);
6968

70-
if (slides.to.dataset.appearevent == "auto") {slides.to.dataset.appearevent == "autoanimate"}
71-
if (options.appearevent == "auto") {options.appearevent == "autoanimate"}
69+
if (slides.to.dataset.appearevent == "auto") {slides.to.dataset.appearevent = "autoanimate"}
70+
if (options.appearevent == "auto") {options.appearevent = "autoanimate"}
7271

7372
if ( !slides.to.dataset.eventdone ) {
7473

@@ -82,6 +81,7 @@ const Plugin = () => {
8281
showAppearances(slides.to);
8382

8483
} else if (event.type == options.appearevent) {
84+
8585
slides.to.dataset.eventdone = true;
8686
showAppearances(slides.to);
8787

@@ -100,7 +100,6 @@ const Plugin = () => {
100100

101101
document.body.dataset.exitoverview = true;
102102

103-
// This hack is because Reveal does not give the correct clicked slide from the overviewhidden event
104103
setTimeout(function () {
105104
document.body.removeAttribute('data-exitoverview')
106105
}, 500)

0 commit comments

Comments
 (0)