Pre-launch: Animation
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
"htmlElements": {
|
"htmlElements": {
|
||||||
"tags": [
|
"tags": [
|
||||||
"a",
|
"a",
|
||||||
|
"base",
|
||||||
"blockquote",
|
"blockquote",
|
||||||
"body",
|
"body",
|
||||||
"br",
|
"br",
|
||||||
|
|||||||
@@ -1,32 +1,38 @@
|
|||||||
<style>
|
<style>
|
||||||
:root{
|
:root{
|
||||||
--wipe-duration: .2s;
|
--wipe-duration: .1s;
|
||||||
--wipe-ease: cubic-bezier(.22,.61,.36,1);
|
--wipe-ease: cubic-bezier(1,.22,.22,1);
|
||||||
--wipe-color: #fff;
|
--wipe-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wipe-overlay{
|
.wipe-overlay{
|
||||||
position: fixed; inset: 0;
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
background: var(--wipe-color);
|
background: var(--wipe-color);
|
||||||
z-index: 2147483647;
|
z-index: 2147483647;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
transform: translateX(0);
|
opacity: 1;
|
||||||
transition: transform var(--wipe-duration) ease-in-out;
|
transition: opacity var(--wipe-duration) var(--wipe-ease);
|
||||||
}
|
}
|
||||||
|
|
||||||
.wipe-overlay.no-trans{ transition: none; }
|
.wipe-overlay.no-trans{
|
||||||
|
transition: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* Tijdens reveal: schuif naar rechts uit beeld */
|
/* Na pageload: fade naar transparant */
|
||||||
.wipe-overlay.is-revealing{ transform: translateX(100%); }
|
.wipe-overlay.is-revealing{
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Bij binnenkomen nieuwe pagina: start links buiten beeld, schuif naar binnen */
|
/* Bij navigatie: fade weer naar volledig zichtbaar */
|
||||||
.wipe-overlay.pre-enter{ transform: translateX(-100%); }
|
.wipe-overlay.is-covering{
|
||||||
.wipe-overlay.is-covering{ transform: translateX(0); }
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
@media (prefers-reduced-motion: reduce){
|
@media (prefers-reduced-motion: reduce){
|
||||||
.wipe-overlay{
|
.wipe-overlay{
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
transform: translateX(100%) !important;
|
opacity: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -39,15 +45,18 @@
|
|||||||
if (!wipe) return;
|
if (!wipe) return;
|
||||||
|
|
||||||
function startReveal(){
|
function startReveal(){
|
||||||
|
// overlay van 1 → 0 (fade-out)
|
||||||
wipe.classList.remove('no-trans');
|
wipe.classList.remove('no-trans');
|
||||||
requestAnimationFrame(function(){
|
requestAnimationFrame(function(){
|
||||||
wipe.classList.add('is-revealing');
|
wipe.classList.add('is-revealing');
|
||||||
|
wipe.classList.remove('is-covering');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Bij binnenkomst pagina: reset + fade-out
|
||||||
window.addEventListener('pageshow', function () {
|
window.addEventListener('pageshow', function () {
|
||||||
wipe.classList.add('no-trans');
|
wipe.classList.add('no-trans');
|
||||||
wipe.classList.remove('pre-enter','is-covering','is-revealing');
|
wipe.classList.remove('is-covering', 'is-revealing');
|
||||||
requestAnimationFrame(startReveal);
|
requestAnimationFrame(startReveal);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -66,26 +75,20 @@
|
|||||||
var here = new URL(window.location.href);
|
var here = new URL(window.location.href);
|
||||||
var url = new URL(a.href, here);
|
var url = new URL(a.href, here);
|
||||||
|
|
||||||
|
// externe link / nieuwe tab / download → negeren
|
||||||
if (url.origin !== here.origin) return;
|
if (url.origin !== here.origin) return;
|
||||||
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
if (e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return;
|
||||||
if (a.target === '_blank' || a.hasAttribute('download')) return;
|
if (a.target === '_blank' || a.hasAttribute('download')) return;
|
||||||
|
|
||||||
var samePath = normPath(url.pathname) === normPath(here.pathname);
|
var samePath = normPath(url.pathname) === normPath(here.pathname);
|
||||||
var sameSearch = url.search === here.search;
|
var sameSearch = url.search === here.search;
|
||||||
|
if (samePath && sameSearch) return;
|
||||||
if (samePath && sameSearch) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
wipe.classList.add('no-trans');
|
// reset naar transparant, dan fade naar opaque
|
||||||
wipe.classList.remove('is-revealing','is-covering');
|
wipe.classList.remove('no-trans', 'is-revealing');
|
||||||
wipe.classList.add('pre-enter');
|
void wipe.offsetHeight; // force reflow zodat transition altijd triggert
|
||||||
void wipe.offsetHeight;
|
|
||||||
|
|
||||||
wipe.classList.remove('no-trans');
|
|
||||||
wipe.classList.remove('pre-enter');
|
|
||||||
wipe.classList.add('is-covering');
|
wipe.classList.add('is-covering');
|
||||||
|
|
||||||
var go = function () {
|
var go = function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user