I
I
Ingerniated2018-07-30 23:55:29
JavaScript
Ingerniated, 2018-07-30 23:55:29

What is the correct time to replace sprites for animation?

Hello!
I downloaded the sprites, but the animation does not work, such as emoticons in the chat, the pictures turn out in pieces and even the acceleration of their change does not make this matter more realistic.
Can you please tell me how to set it correctly in js?
Or do you need more than 5 pictures for smoothness?
5b5f7b21888dd152743869.png5b5f7b25e5809465339814.png5b5f7b293593b555964617.png5b5f7b2b90b5a369973304.png5b5f7b2eade4a983048802.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
forspamonly2, 2018-08-03
@Ingernirated

no need to cut into separate pictures.
css3 animation can have a fixed number of steps.
so output a one-frame block, give it your storyboard image as a background, animate the background position offset and set the number of steps to it equal to the number of frames.
like here: https://codepen.io/bsl-zcs/pen/lpaGv
and five frames is just a very short animation, a fifth of a second. looks pretty smooth at the right speed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question