taos
Version:
TAOS - Tailwind CSS Animation on Scroll Library
60 lines (54 loc) • 2.38 kB
HTML
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TAOS</title>
<script src="https://unpkg.com/@tailwindcss/browser@4"></script>
<style type="text/tailwindcss">
@custom-variant taos (&.taos-init:where(:not(.taos-animate)));
html.js :where([class*="taos:"]:not(.taos-init)) {
visibility: hidden;
}
@source inline('!duration-[0ms] !delay-[0ms]');
</style>
<script>
document.documentElement.classList.add("js");
</script>
</head>
<body>
<div id="app">
<section class="py-[5px]">
<div
class="bg-purple-600/40 py-12 delay-[300ms] duration-[700ms] taos:translate-y-[200px] taos:opacity-0"
data-taos-offset="0"
>
<h1 class="text-9xl">Test</h1>
</div>
<div class="opacity-0"></div>
<div class="my-[2000px] flex flex-col justify-center items-center">
<div class="h-1 w-full bg-blue-600"></div>
<span
class="bg-purple-600/40 py-12 delay-[300ms] duration-[700ms] taos:translate-y-[200px] taos:opacity-0 [animation-iteration-count:infinite]"
data-taos-offset="500"
><h1 class="text-9xl">Test</h1></span
><span
class="bg-purple-600/40 py-12 delay-[300ms] duration-[700ms] taos:translate-y-[200px] taos:opacity-0"
data-taos-offset="0"
><h1 class="text-9xl">Test</h1></span
>
<svg
class="delay-[300ms] duration-[700ms] taos:translate-y-[200px] taos:opacity-0"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 576 512"
>
<path
d="M575.8 255.5c0 18-15 32.1-32 32.1l-32 0 .7 160.2c0 2.7-.2 5.4-.5 8.1l0 16.2c0 22.1-17.9 40-40 40l-16 0c-1.1 0-2.2 0-3.3-.1c-1.4 .1-2.8 .1-4.2 .1L416 512l-24 0c-22.1 0-40-17.9-40-40l0-24 0-64c0-17.7-14.3-32-32-32l-64 0c-17.7 0-32 14.3-32 32l0 64 0 24c0 22.1-17.9 40-40 40l-24 0-31.9 0c-1.5 0-3-.1-4.5-.2c-1.2 .1-2.4 .2-3.6 .2l-16 0c-22.1 0-40-17.9-40-40l0-112c0-.9 0-1.9 .1-2.8l0-69.7-32 0c-18 0-32-14-32-32.1c0-9 3-17 10-24L266.4 8c7-7 15-8 22-8s15 2 21 7L564.8 231.5c8 7 12 15 11 24z"
/>
</svg>
</div>
</section>
</div>
<script src="../dist/taos.js"></script>
</body>
</html>