105 lines
2.4 KiB
HTML
105 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>Animated Shapes</title>
|
|
<style>
|
|
html {
|
|
height: 100%;
|
|
--spring-easing: linear(
|
|
0,
|
|
0.01,
|
|
0.04 1.5%,
|
|
0.163 3.2%,
|
|
0.824 9.2%,
|
|
1.055,
|
|
1.199 14.2%,
|
|
1.24,
|
|
1.263,
|
|
1.265 18.2%,
|
|
1.243 19.9%,
|
|
0.996 28.8%,
|
|
0.951,
|
|
0.93 34.1%,
|
|
0.929 35.7%,
|
|
0.935 37.5%,
|
|
1 46.3%,
|
|
1.018 51.4%,
|
|
1.017 55.1%,
|
|
0.995 68.6%,
|
|
1.001 85.5%,
|
|
1
|
|
);
|
|
--spring-duration: 1s;
|
|
}
|
|
|
|
body {
|
|
min-height: 100%;
|
|
position: relative;
|
|
margin: 0;
|
|
}
|
|
|
|
::view-transition-group(*),
|
|
::view-transition-old(*),
|
|
::view-transition-new(*) {
|
|
animation-timing-function: var(--spring-easing);
|
|
animation-duration: var(--spring-duration);
|
|
}
|
|
|
|
::view-transition-old(*),
|
|
::view-transition-new(*) {
|
|
height: 100%;
|
|
}
|
|
|
|
folk-shape {
|
|
background: black;
|
|
color: white;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<folk-shape x="100" y="100" width="50" height="50"></folk-shape>
|
|
<folk-shape x="100" y="200" width="50" height="50"></folk-shape>
|
|
<folk-shape x="100" y="300" width="50" height="50"></folk-shape>
|
|
|
|
<script type="module">
|
|
import '../lib/standalone/folk-shape.ts';
|
|
|
|
const geos = document.querySelectorAll('folk-shape');
|
|
|
|
geos.forEach((el, i) => (el.style.viewTransitionName = `g${i}`));
|
|
|
|
while (true) {
|
|
await document.startViewTransition(() => {
|
|
geos.forEach((el) => {
|
|
el.x += 100;
|
|
el.width = 90;
|
|
});
|
|
}).finished;
|
|
|
|
await document.startViewTransition(() => {
|
|
geos.forEach((el) => {
|
|
el.y += 100;
|
|
el.height = 90;
|
|
});
|
|
}).finished;
|
|
|
|
await document.startViewTransition(() => {
|
|
geos.forEach((el) => {
|
|
el.x -= 100;
|
|
el.width = 50;
|
|
});
|
|
}).finished;
|
|
|
|
await document.startViewTransition(() => {
|
|
geos.forEach((el) => {
|
|
el.y -= 100;
|
|
el.height = 50;
|
|
});
|
|
}).finished;
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|