FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fly · Issue #6 · wchaowu/javascript · GitHub

Fly #6

Description

<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


    Back | FazBrowse Home | New Git URL