CSS3 Animations--Basic guidelines

Source: Internet
Author: User

Guidelines for animation
    1. Use the CSS keyframe animation or CSS transitions, if at all possible. The browser can optimize painting and compositing bigtime here.
    2. If needs to is it ' s js-based animation, use requestAnimationFrame . Avoid setTimeout , setInterval .
    3. Avoid changing inline styles on every frame (jQuery animate() -style) If you can, declarative animations in CSS can be optimize D by the browser.
    4. Using 2D transforms instead of absolute positioning would typically provide better FPS by the by-the-smaller paint times and SM Oother Animation.
    5. Use Timeline Frame ' s mode to investigate, what's slowing down your behavior
    6. "Show Paint rects" and "Render composited Layer Borders" is good pro-moves to verify where your element is being rendered .
Animation guidelines
    1. Use keyframe animation or CSS transition instead of other methods (such as settimeout,requestanimationframe, if conditions permit) Although the latter performance is already very high) the browser can be implemented to optimize the drawing to integrate repetitive work
    2. If you need to use the JS timer, use Requestanimationfram to avoid using settimeout and setinterval
    3. Avoid changing inline style directly on elements (as Jquer animate () does) if possible, declaring animations within a CSS file will be more supported by the browser's optimization scheme
    4. Use 2Dtransform instead of Position:absolute animations, which will result in better FPS frames and smoother animations (make sure Display:block or Display:inline-block)
    5. Use Timeline Frame ' s mode (inside chrome) to check what causes poor performance
    6. Using the "Show Paint rects" and "Render composited Layer Borders" features (in Chrome's rendering) is a great way to see your page element rendering process

CSS3 Animations--Basic guidelines

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.