Yahoo India Web Search

Search results

  1. Oct 6, 2020 · To improve the performance of your CSS animations, use the transform and opacity CSS properties as much as possible, and avoid anything that triggers layout or painting.

    • Examples

      Examples of high-performance CSS animations....

    • Animations

      A curated collection of high-quality resources that will...

  2. Oct 23, 2020 · Examples of high-performance CSS animations. bookmark_border. Rachel Andrew. In this post find out how some popular animations found on CodePen have been created. These animations all use the performant techniques discussed in other articles in this section.

    • Overview
    • CSS transitions and animations
    • requestAnimationFrame
    • Performance comparison: transitions vs. requestAnimationFrame
    • Summary

    Animations are critical for a pleasurable user experience on many applications. There are many ways to implement web animations, such as CSS transitions/animations or JavaScript-based animations (using requestAnimationFrame()). In this article, we analyze the performance differences between CSS-based and JavaScript-based animation.

    Both CSS transitions and animations can be used to write animation. They each have their own user scenarios:

    •CSS transitions provide an easy way to make animations occur between the current style and an end CSS state, e.g., a resting button state and a hover state. Even if an element is in the middle of a transition, the new transition starts from the current style immediately instead of jumping to the end CSS state. See Using CSS transitions for more details.

    •CSS animations, on the other hand, allow developers to make animations between a set of starting property values and a final set rather than between two states. CSS animations consist of two components: a style describing the CSS animation, and a set of key frames that indicate the start and end states of the animation's style, as well as possible intermediate points. See Using CSS animations for more details.

    In terms of performance, there is no difference between implementing an animation with CSS transitions or animations. Both of them are classified under the same CSS-based umbrella in this article.

    The requestAnimationFrame() API provides an efficient way to make animations in JavaScript. The callback function of the method is called by the browser before the next repaint on each frame. Compared to setTimeout()/setInterval(), which need a specific delay parameter, requestAnimationFrame() is much more efficient. Developers can create an animation by changing an element's style each time the loop is called (or updating the Canvas draw, or whatever.)

    For more details read animating with JavaScript from setInterval to requestAnimationFrame.

    The fact is that, in most cases, the performance of CSS-based animations is almost the same as JavaScripted animations — in Firefox at least. Some JavaScript-based animation libraries, like GSAP and Velocity.JS, even claim that they are able to achieve better performance than native CSS transitions/animations. This can occur because CSS transitions/animations are resampling element styles in the main UI thread before each repaint event happens, which is almost the same as resampling element styles via a requestAnimationFrame() callback, also triggered before the next repaint. If both animations are made in the main UI thread, there is no difference performance-wise.

    In this section we'll walk you through a performance test, using Firefox, to see what animation method seems better overall.

    Browsers are able to optimize rendering flows. In summary, we should always try to create our animations using CSS transitions/animations where possible. If your animations are really complex, you may have to rely on JavaScript-based animations instead.

  3. Apr 3, 2024 · Building competent CSS animations that look awesome not only add the visual interest but they also improve user experience without slacking on the overall site performance.

    • CSS Animations With SVGs. Author: Joyanna (joyanna) Links: Source Code / Demo. Created on: May 8, 2020. Made with: HTML, SCSS.
    • Only Css Animation. Author: Hisami Kurita (hisamikurita) Links: Source Code / Demo. Created on: September 22, 2019. Made with: HTML, CSS. Tags: cssanimation.
    • Only Css Animation #01. Author: Hisami Kurita (hisamikurita) Links: Source Code / Demo. Created on: September 7, 2019. Made with: HTML, CSS. Tags: cssanimation.
    • Pure CSS "Eye" Author: Julia Miocene (miocene) Links: Source Code / Demo. Created on: April 12, 2020. Made with: HTML, PostCSS, JS.
  4. Aug 28, 2024 · CSS animations allow you to animate HTML elements without using JavaScript. By defining keyframes and using the @keyframes rule, you can animate properties such as color, size, and position over a specified duration, creating dynamic and engaging web interfaces. Fundamentals of CSS Animations. Core Concepts.

  5. People also ask

  6. web.dev › explore › animationsAnimations - web.dev

    A curated collection of high-quality resources that will help you understand why some animations are slow, and how to build and debug your own animations with CSS or JavaScript.