Skip to content

Fly #6

Open
Open
Fly#6
@Youssef56oz

Description

@Youssef56oz
<title>Fly Animation</title> <style> #fly { width: 50px; height: 50px; background-color: #3498db; position: absolute; } </style>
<script> // Get the fly element const fly = document.getElementById('fly'); // Set initial position of the fly let positionX = 0; let positionY = 0; // Function to move the fly function moveFly() { // Update position positionX += 5; positionY += 3; // Set new position fly.style.left = positionX + 'px'; fly.style.top = positionY + 'px'; // Repeat the animation requestAnimationFrame(moveFly); } // Start the animation moveFly(); </script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions