On the usage resolution of animation animation properties in CSS3

Source: Internet
Author: User
This article is mainly for you to introduce in detail the Animation animation attribute usage in CSS3, teach you how to use animation animation, interested in small partners can refer to

To use animation animations, familiarize yourself with the grammar rules of Keyframes,keyframes: Naming is preceded by "@keyframes", followed by the "name of the animation" plus a pair of curly braces "{}", which are the different time-period style rules in parentheses. Different keyframes are represented by the from (equivalent to 0%), to (equivalent to 100%), or percent (for best browser support, percent recommended), as follows to define a simple animation:

@keyframes Myfirst/* Define the animation name */    {       0%   {background:red; left:0px; top:0px;}/* Define the starting frame style, 0% can be converted to from*/    25%  {background:yellow; left:200px; top:0px;}       50%  {background:blue; left:200px; top:200px;}       75%  {background:green; left:0px; top:200px;}       100% {background:red; left:0px; top:0px;}/* Define end frame style, 100% can be converted to to*/    }

@keyframes is defined so that it works, it must be bound to a selector by animation, otherwise the animation will have no effect. The properties of the animation are listed below:

All of the above properties are set below

Animation-name:myfirst;   animation-duration:5s;   Animation-timing-function:linear;   Animation-delay:1s;   Animation-iteration-count:infinite;   Animation-direction:alternate;   animation-play-state:running;

All of the above code can be abbreviated as follows:

Animation:myfirst 5s linear 2s infinite alternate;   animation-play-state:running;
Browser Compatibility

Internet Explorer 10, Firefox, and Opera support @keyframes rules and animation properties.

Chrome and Safari need a prefix of-webkit-.

Note: Internet Explorer 9, and earlier versions, do not support @keyframe rules or animation properties.

The following is a complete code example of the KeyFrames and animation properties described above:

<! DOCTYPE html>

The above code shows a square along a square trajectory movement, the cardinal number in the positive direction of movement, even several times in the opposite direction of movement, motion process also with color changes. Specific effect, the reader can run the code observation on its own.

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

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.