Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8158223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:32:24+00:00 2026-06-06T17:32:24+00:00

I need to understand how to create a simple animation in HTML 5 or

  • 0

I need to understand how to create a simple animation in HTML 5 or CSS3.

Suppose you have this sprite (see picture) and you need to create an animation with 4 frames. The animation has to last exactly 1 second. I don’t want a smooth animation between the frames, I want it to jump from one state to the other without interpolation. These are the ball 4 frames:

                  X        Y      ROTATION       OPACITY (%)
First frame:     100      220        10            5
Second frame:    150      240        18            25
Third frame:     160      280        32            55
Fourth frame:    170      290        47            78

In resume, every 0.25s the ball has to assume one of these keyframes. No loop on the animation.

Can you guys give an example on how to do that using CSS or HTML5/Javascript? (the method that produces the less CPU intensive approach). Thanks.

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:32:25+00:00Added an answer on June 6, 2026 at 5:32 pm

    This can be done with pure CSS3 using @keyframes, animation, transform: rotate(angle) translate(x,y); and opacity.

    Here’s an example (using the -webkit- vendor prefix, use -moz-, -o-, -ms- for optimal compatibility): http://jsfiddle.net/QaPaK/
    The example only works in Chrome and Safari, because I did not add the other prefixes for a compact example.

    HTML (animating an <img> element, for example):

    <img src="https://i.stack.imgur.com/KLNOU.png" id="test">​
    

    CSS:

    /* Replace -webkit- with moz-, -o-, -ms- for cross-browser compatibility */
    #test {
        -webkit-transform-origin: top left;
        -webkit-animation-name: foo;
        -webkit-animation-duration: 1s;
        -webkit-animation-iteration-count: 1;
    }
    @-webkit-keyframes foo {
        0%, 25% { /* State 1 */
            -webkit-transform: rotate(10deg) translate(100px, 200px);
            opacity: 0.05;
        }
        25%, 50% { /* State 2 */
            -webkit-transform: rotate(18deg) translate(150px, 240px);
            opacity: 0.25;
        }
        50%, 75% { /* State 3 */
            -webkit-transform: rotate(32deg) translate(160px, 280px);
            opacity: 0.55;
        }
        75%, 100% { /* State 4 */
            -webkit-transform: rotate(47deg) translate(170px, 290px);
            opacity: 0.78;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that we need to create MXML file to define a view. Suppose
I have written simple lexical analyzer. And I understand the need to provide each
So I have some animation blocks to create some very simple animations on my
I need to understand the working of this particular program, It seems to be
I don't know if this is a right question, but i need to understand
I edited this question after i found a solution... i need to understand why
This is trivial, probably silly, but I need to understand what state cout is
I'm really new to Regex and working hard, but this has gone beyond simple
I can't understand why this doesn't work, or what I need to get it
I have a table videos and I need to create top videos for it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.