Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Add pager and reveal transitions #52

Merged
merged 2 commits into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
fill: none;
stroke-width: var(--pager-stroke-inner-width, 1.8);
stroke-linecap: round;
transition: stroke-dasharray 500ms cubic-bezier(0.23, 1, 0.320, 1);
}

.deckgo-pager-percentage {
Expand Down
3 changes: 3 additions & 0 deletions src/components/slides/deckdeckgo-slide.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
--slide-padding-bottom-default: 64px;
--slide-padding-start-default: 64px;

--slide-reveal-transform: translateX(-4px);
--slide-reveal-duration: 200ms;

@media screen and (max-width: 1024px) {
--slide-padding-top-default: 16px;
--slide-padding-end-default: 32px;
Expand Down
9 changes: 9 additions & 0 deletions src/components/slides/deckdeckgo-slide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ export class DeckdeckgoSlideUtils {
} else {
Array.from(elements).forEach((element: HTMLElement) => {
element.style.setProperty('visibility', 'hidden');
element.style.setProperty('transform', 'var(--slide-reveal-transform)');
element.style.setProperty('opacity', '0');

element.classList.add('deckgo-reveal');
element.style.setProperty('transition', 'all var(--slide-reveal-duration) cubic-bezier(0.23, 1, 0.320, 1)');

});
}
});
Expand All @@ -45,6 +50,8 @@ export class DeckdeckgoSlideUtils {

if (nextElement) {
nextElement.style.setProperty('visibility', 'initial');
nextElement.style.setProperty('opacity', '1');
nextElement.style.setProperty('transform', 'none');
couldSwipe = false;
}
}
Expand All @@ -67,6 +74,8 @@ export class DeckdeckgoSlideUtils {

if (nextElement) {
nextElement.style.setProperty('visibility', 'hidden');
nextElement.style.setProperty('transform', 'var(--slide-reveal-transform)');
nextElement.style.setProperty('opacity', '0');
couldSwipe = false;
}
}
Expand Down