Skip to content

Commit 765e53b

Browse files
committed
add animation
1 parent de70ac6 commit 765e53b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

capybara.jpg

-66.8 KB
Binary file not shown.

themes/capy/layouts/index.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
11
{{ define "hero" }}
2+
<script src="https://cdn.jsdelivr.net/npm/motion@latest/dist/motion.min.js" async></script>
3+
<script>
4+
document.addEventListener("DOMContentLoaded", (event) => {
5+
const animate = Motion.animate;
6+
const inView = Motion.inView;
7+
8+
document.querySelectorAll(".bento-card").forEach((element) => {
9+
element.style.opacity = "0";
10+
element.style.transform = "translateX(-200px)";
11+
})
12+
13+
inView(".bento-card", (info) => {
14+
const controls = animate(info.target,
15+
{ opacity: 1, transform: "none" },
16+
{ delay: 0.1, duration: 0.5, easing: "ease-in-out" });
17+
return (leaveInfo) => controls.stop();
18+
})
19+
})
20+
</script>
221
<div class="row" style="color: #333">
322
<div style="line-height: 1.2;" class="">
423
<h1 style="line-height: 1.0; font-size: 6rem; font-family: Arial, Helvetica, sans-serif; text-align: center;">Capy — Create cross-platform apps in Zig</h1>

0 commit comments

Comments
 (0)