Skip to content

Commit

Permalink
Level2 added a trailer
Browse files Browse the repository at this point in the history
  • Loading branch information
prajjwal000 committed Feb 11, 2024
1 parent 30308c7 commit 44e3325
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bloby site</title>
<script src="https://cdn.jsdelivr.net/npm/kute.js@2.1.2/dist/kute.min.js"></script>
<link rel="stylesheet" href="style.css">
</head>

<body>

<script type="module" src="main.js"></script>

<div id="trailer"></div>
<section>
<div class="blob-content">
<h1>Nice curves</h1>
Expand Down
8 changes: 8 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
import './style.css'

const trailer = document.getElementById("trailer");

window.onmousemove = e => {
const x = e.clientX - trailer.offsetWidth/2,
y = e.clientY - trailer.offsetHeight/2;
trailer.style.transform = `translate(${x}px, ${y}px)`;
}
18 changes: 18 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
#trailer {
height:20px;
width:20px;
background-color: aqua;
border-radius:20px;

position:fixed;
left:0px;
top:0px;
z-index:10;
pointer-events:none;

opacity:0;
transition:opacity 500ms ease;
}
h1 {
font-size: 4rem;
}
Expand Down Expand Up @@ -30,3 +45,6 @@ section {
z-index: 0;
transform: translateY(-45%);
}
body:hover > #trailer {
opacity:1;
}

0 comments on commit 44e3325

Please sign in to comment.