Which is faster, JavaScript or CSS animation?

Asked 1 years ago, Updated 1 years ago, 45 views

For example, when you do horizontal animation, which one is faster?

  • Animation using the transition property
  • animation with transform:translate3D and so on in requestAnimationFrame

Speed = I would like to know which FPS is better.

For example, for devices with poor specs,
From the question of which FPS is more expensive
It was a question.

javascript css

2022-09-30 19:54

1 Answers

Both CSS transition and requestAnimationFrame() will update the drawing according to the hardware refresh rate.Therefore, the FPS will be the same regardless of whether the CPU is fast enough.

requestAnimationFrame() is more likely to cause the FPS to drop when the CPU is slow or animation or other processes are heavy.There is always an overhead to bridge the browser's native code with the JavaScript world.


2022-09-30 19:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.