CSS3 Animation's Steps way transition

Source: Internet
Author: User

Animation By default transitions in ease mode, which inserts motion tweens between each keyframe , so the animation effect

is consistent in nature. In addition to transition functions such as ease,linear, Cubic-bezier, they are inserted into a tween.

However, some effects do not need to be tween, only need to jump between keyframes, then you should use the steps transition mode.

For example, GIF motion diagram does not support program control of playback, nor does it support alpha channel. But if we use a

PNG Pictures, put all the frames together, through the CSS3 animation control background-position

You can do this by playing it.

    <style>    @-webkit-keyframes Test {      0% {background-position:0px-0%;}      100% {background-position:0px-400%;}    }    @keyframes Test {      0% {background-position:0px-0%;}      100% {background-position:0px-400%;}    }    div {      height:35px;width:32px;      -webkit-animation:test 400ms Steps (4) infinite;      Animation:test 400ms Steps (4) infinite;      Background:url (http://www.web-tinker.com/share/. png);    }    </style>    <div></div>

Steps (4) indicates that the entire animation is toggled between 4 keyframes. The picture of this bunny rubbing face

Contains 4 frames, so this is set to 4. And our animation duration is 400ms, which means that each frame

Stay 100ms, this is the same effect as the normal GIF motion diagram. and animation can

Control playback State, PNG can provide alpha channel. But animation the compatibility of this thing

It is still not well, and it remains to be seen whether it can be used for formal projects.

CSS3 Animation's Steps way transition

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.