Untitled
unknown
plain_text
9 months ago
1.4 kB
8
Indexable
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Red Circle Animation</title>
<style>
body {
margin: 0;
height: 100vh;
background-color: white;
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
#circle {
width: 2vmin;
height: 2vmin;
border-radius: 50%;
background-color: red;
position: absolute;
transition: all 5s ease;
}
</style>
</head>
<body>
<div id="circle"></div>
<script>
const circle = document.getElementById('circle');
// Initially, position the circle at the center
circle.style.left = '50%';
circle.style.top = '50%';
circle.style.transform = 'translate(-50%, -50%)';
// After 15 seconds, move the circle and expand it
setTimeout(() => {
// Move the circle 10% of the field of vision to the right
const rightPosition = 50 + 10; // 50% (center) + 10%
circle.style.left = `${rightPosition}%`;
// After it moves, expand the circle to 4% of the field of vision
circle.style.width = '4vmin';
circle.style.height = '4vmin';
}, 15000);
</script>
</body>
</html>
Editor is loading...
Leave a Comment