Skip to content

Fly #6

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>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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