viewBox="0 0 100 100"
100vw
100lvh
700px
FIXED
relative
flexbox
absolute
FIXED
relative
flexbox
absolute
central
peripheral
peripheral
central
peripheral
peripheral
sneaky stuff
sneaky stuff
I am a website
I am a new page
Exit
Entrance
Persistent
Vanishing
Appearing
Levitating
with a little bit of...
withÂ
irst
ast
nvert
lay
{
top: 300,
left: 900,
width: 200,
height: 500,
}
width
height
top
left
el.getBoundingClientRect()
{
top: 10,
left: 200,
width: 500,
height: 1000,
}
Where the magic happens
translate(200px, 100px) scale(2.5)
translate(0px, 0px) scale(1)
const first = box.getBoundingClientRect();
switchItUp()
const last = box.getBoundingClientRect();
let delta = {
x: -1 * (last.left - first.left),
y: -1 * (last.top - first.top),
};
box.style.transform = `translate(${delta.x}px, ${delta.y}px)`;
requestAnimationFrame(function () {
el.classList.add("animate");
el.style.transform = "none";
});
.animate {
transition: transform 1s ease-in-out;
}
const first = box.getBoundingClientRect();
switchItUp()
const last = box.getBoundingClientRect();
let delta = {
x: -1 * (last.left - first.left),
y: -1 * (last.top - first.top),
};
box.style.transform = `translate(${delta.x}px, ${delta.y}px)`;
requestAnimationFrame(function () {
el.classList.add("animate");
el.style.transform = "none";
});
.animate {
transition: transform 1s ease-in-out;
}
let state = Flip.getState(card);
switchItUp()
Flip.from(state)
irst
ast
nvert
lay
irst
ast
ffset
arent
use your magical powers responsibly
const animationIsOk = window.matchMedia(
'(prefers-reduced-motion: no-preference)'
).matches;
if (animationIsOk) {
// magic time
}