Home > Web Front-end > HTML Tutorial > Mobile Web front-end development CSS animation experience sharing_html/css_WEB-ITnose

Mobile Web front-end development CSS animation experience sharing_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:53:32
Original
1691 people have browsed it

Talking about animation effects. CSS animation is a powerful tool for Mobilweb development, and CSS animation must be discussed. Due to issues such as Mobil device capabilities, most animation implementation plans on PC are not feasible on Mobil. Fortunately, I can use CSS animation on Mobil. Today I will take a look at the three main members of CSS animation.

CSS change (Transit

The default mutation animation of transit. When the CSS properties are changed, define the CSS properties that need to be changed. The transit animation is triggered. But not all CSS property changes will trigger translat. There is no official document that lists those that are possible and those that are not, but you can use some tips to identify them. For example, those values ​​are continuous numeric characteristics. For example, width, height, top, left, color, opac are all possible, but visibl is not possible, even though its value is a numeric type. But it is not continuous

and has high performance. It can be run on transitiphon and Android platforms.

It can also be defined through JavaScript. It is very easy to use. 🎜>

1. Define the transit characteristics of the Dom element (duratdelaitimefunction, etc.) 2. Use JavaScript to change the CSS style of the Dom element

How to, 1. Define the transit characteristics of the Dom element (duratdelaitimefunction, etc.) 2 .Use JavaScript to change the CSS style of the Dom element

-webkit-transition-properti defines the characteristics of the required mutation-webkit-transition-dur defines the animation time-webkit-transition-delai defines the delay time-webkit-transition-timing-funct definition Bezier curve function

-webkit-transition-properti can define specific characteristics, -webkit-transition-properti defines the characteristics that require mutation -webkit-transition-dur defines animation time -webkit-transition -delai defines delay time -webkit-transition-timing-funct defines Bezier curve function

<-webkit-transition-properti can define specific characteristics that require mutation. Features - webkit-transition-dur defines animation time - webkit-transition-delai defines delay time - webkit-transition-timing-funct defines Bezier curve function < - webkit-transition-properti can define specific characteristics . For example, multiple properties of widthheight are separated by commas. You can also define all so that all style property changes with continuous numerical types will trigger transition. Now you can try to create a transit

div.zoom-fad{-webkit-transition-property: -webkit-transform,div.zoom-fad{-webkit-transition-property:-webkit-transform,div.zoom-fad{-webkit-transition-property:-webkit-transform,opacity;-webkit-transition-duration: 4s,2s;-webkit-transition-delay:2s,0;}

You can also write these characteristics in one line,

div.slid{-webkit- transition:opac500mease-out100ms;}

-webkit-transition-timing-funct can define the mutation speed curve of the animation, div.slid{-webkit-transition:opac500mease-out100ms;}

<- webkit-transition-timing-funct can define the mutation speed curve of animation. div.slid{-webkit-transition:opac500mease-out100ms;}<-webkit-transition-timing-funct can define the mutation speed curve of the animation. It can be set to,

gradually slow down, and the Bezier curve function is cubic-bezi0.25, eas is the default. -webkit-transition-timing-funct can also set the short name. 0.1,0.25,1.0linear average speed, Bezier curve function is cubic-bezi0.0,0.0,1.0,1.0ease-in accelerates, Bezier curve function is cubic-bezi0.42,0,1.0, 1.0ease-out slows down when fading out. The Bezier curve function is cubic-bezi0,0,0.58,1.0ease-in-out speeds up and then slows down. The Bezier curve function is cubic-bezi0.42,0,0.58,1.0

You can also directly set your own defined Bezier curve function

The webkitTransitionEnd event will be triggered after the transition is completed. You can use addEventListen to add event listeners.

element.addEventListen'webkitTransitionEnd',element.addEventListen'webkitTransitionEnd',element.addEventListen'webkitTransitionEnd',functionevent{alert"Finishtransition";};

A nimat

A nimat

A nimat

A nimat

transit is very simple and convenient to use, but if you want to control the changes of each frame yourself, then transit is not satisfactory. At this time, you need to use animanim with the following features,

-webkit-animation-nam specifies the keyframe name (the name of the animation) -webkit-animation-dur specifies the number of seconds or milliseconds to complete the animation-webkit -animation-timing-funct specifies the speed curve of the animation -webkit-animation-delai delays the start of animation -webkit-animation-iteration-count playback times; default: 1 can be defined as infinite) -webkit-animation-direct animation direction; Default: normal

Anim, which is different from transit, needs to define frames. -webkit-animation-nam specifies the key frame name (the name of the animation) -webkit-animation-dur specifies the number of seconds or milliseconds to complete the animation -webkit-animation- timing-funct specifies the speed curve of the animation -webkit-animation-delai delays the start of animation -webkit-animation-iteration-count playback times; default: 1 can be defined as infinite) -webkit-animation-direct animation direction; default: normal

@-webkit-keyframsquarePath{from{top:100px;left:100px;}to{top:0px;left:0px;}

use from represents the starting frame, @-webkit-keyframsquarePath{from{top:100px;left:100px;}to{top:0px;left:0px;}

@-webkit-keyframsquarePath{from{top:0px;left:0px;}25%{top:0px;left:100px;}50%{ top:100px;left:100px;}75%{top:100px;left:0px;}100%{top:0px;left:0px;}

This way I can define a complete anim

.squareA nim{-webkit-animation-name:squarePath;-webkit-animation-duration:4s;-webkit-animation-timing-function:linear;-webkit-animation-iteration-count:infinite;}

You can also use abbreviations, .squareA nim{-webkit-animation-name:squarePath;-webkit-animation-duration:4s;-webkit-animation-timing-function:linear;-webkit-animation-iteration- count:infinite;}

-webkit-animation:squarePath4slinear0infinite

When I define anim and use JavaScript to set animations to elements, -webkit-animation:squarePath4slinear0infinite

A series of events will be triggered when anim is running.

webkitA nimationStart animation starts webkitA nimationIteration animation repeatedly executes webkitA nimationEnd animation ends

You can still monitor these events.

Transform

Transform is primarily a change. Transform, deform... It does not have the function of mutation or animation, but the combination of transform and transit can achieve very beautiful and powerful effects. Commonly used features include:

The transform coordinate system is different from the coordinate system of the document flow. Displacement

means that when the element is transformed, it will not affect the original document flow. rotat rotation skew skew scale proportion translat change.

You can use CSS to operate transform

You can also use JavaScript to operate the webkitTransform feature to set or get transform-20pxscale2rotat45degtranslat5px.

div.style.webkitTransform='rotateY10degtranslateX10px';

Strings operated by the above methods, div.style.webkitTransform='rotateY10degtranslateX10px';

vartheTransform=window.getComputedStyldiv.webkitTransform;varmatrix=newWebKitCSSMatrixtheTransform;

The returned matrix not only contains matrix characteristics, but also contains some methods that allow me to set transform, vartheTransform= window.getComputedStyldiv.webkitTransform;varmatrix=newWebKitCSSMatrixtheTransform;


http://bbs.house.qq.com/t-6362718-1.htm
http://bbs.house.qq.com/t-6362741-1.htm
http://bbs.house.qq.com/t-6362762-1.htm
http://bbs.house.qq.com/t-6362796-1.htm
http://bbs.house.qq.com/t-6362813-1.htm
http://bbs.house.qq.com/t-6362829-1.htm
http://bbs.house.qq.com/t-6362853-1.htm
http://bbs.house.qq.com/t-6362882-1.htm
http://bbs.house.qq.com/t-6362911-1.htm
http://bbs.house.qq.com/t-6362928-1.htm
http://bbs.house.qq.com/t-6362948-1.htm
http://bbs.house.qq.com/t-6362976-1.htm
http://bbs.house.qq.com/t-6362993-1.htm
http://bbs.house.qq.com/t-6363008-1.htm
http://bbs.house.qq.com/t-6363024-1.htm
http://bbs.house.qq.com/t-6363054-1.htm
http://bbs.house.qq.com/t-6363074-1.htm
http://bbs.house.qq.com/t-6363089-1.htm
http://bbs.house.qq.com/t-6363107-1.htm
http://bbs.house.qq.com/t-6363122-1.htm
http://bbs.house.qq.com/t-6363137-1.htm
http://bbs.house.qq.com/t-6363154-1.htm
http://bbs.house.qq.com/t-6363177-1.htm
http://bbs.house.qq.com/t-6363201-1.htm
http://bbs.house.qq.com/t-6363219-1.htm
http://bbs.house.qq.com/t-6363236-1.htm
http://bbs.house.qq.com/t-6363255-1.htm
http://bbs.house.qq.com/t-6363288-1.htm
http://bbs.house.qq.com/t-6363304-1.htm
http://bbs.house.qq.com/t-6363323-1.htm
http://bbs.house.qq.com/t-6363336-1.htm
http://bbs.house.qq.com/t-6363377-1.htm
http://bbs.house.qq.com/t-6363403-1.htm
http://bbs.house.qq.com/t-6363428-1.htm
http://bbs.house.qq.com/t-6363448-1.htm
http://bbs.house.qq.com/t-6363462-1.htm
http://bbs.house.qq.com/t-6363489-1.htm
http://bbs.house.qq.com/t-6363508-1.htm
http://bbs.house.qq.com/t-6363542-1.htm
http://bbs.house.qq.com/t-6363563-1.htm
http://bbs.house.qq.com/t-6363596-1.htm
http://bbs.house.qq.com/t-6363618-1.htm
http://bbs.house.qq.com/t-6363635-1.htm
http://bbs.house.qq.com/t-6363657-1.htm
http://bbs.house.qq.com/t-6363681-1.htm
http://bbs.house.qq.com/t-6363716-1.htm
http://bbs.house.qq.com/t-6363744-1.htm
http://bbs.house.qq.com/t-6363764-1.htm
http://bbs.house.qq.com/t-6363782-1.htm
http://bbs.house.qq.com/t-6363798-1.htm
http://bbs.house.qq.com/t-6363828-1.htm
http://bbs.house.qq.com/t-6363858-1.htm
http://bbs.house.qq.com/t-6363893-1.htm
http://bbs.house.qq.com/t-6363916-1.htm
http://bbs.house.qq.com/t-6363947-1.htm
http://bbs.house.qq.com/t-6363966-1.htm
http://bbs.house.qq.com/t-6363994-1.htm
http://bbs.house.qq.com/t-6364097-1.htm
http://bbs.house.qq.com/t-6364120-1.htm
http://bbs.house.qq.com/t-6364206-1.htm
http://bbs.house.qq.com/t-6364225-1.htm
http://bbs.house.qq.com/t-6364241-1.htm
http://bbs.house.qq.com/t-6364254-1.htm
http://bbs.house.qq.com/t-6364271-1.htm
http://bbs.house.qq.com/t-6364302-1.htm
http://bbs.house.qq.com/t-6364370-1.htm
http://bbs.house.qq.com/t-6364384-1.htm
http://bbs.house.qq.com/t-6364402-1.htm
http://bbs.house.qq.com/t-6364419-1.htm
http://bbs.house.qq.com/t-6364432-1.htm
http://bbs.house.qq.com/t-6364445-1.htm
http://bbs.house.qq.com/t-6364464-1.htm
http://bbs.house.qq.com/t-6364490-1.htm
http://bbs.house.qq.com/t-6364505-1.htm
http://bbs.house.qq.com/t-6364521-1.htm
http://bbs.house.qq.com/t-6364546-1.htm
http://bbs.house.qq.com/t-6364571-1.htm
http://bbs.house.qq.com/t-6364599-1.htm
http://bbs.house.qq.com/t-6364653-1.htm
http://bbs.house.qq.com/t-6365164-1.htm
http://bbs.house.qq.com/t-6365189-1.htm
http://bbs.house.qq.com/t-6365227-1.htm
http://bbs.house.qq.com/t-6365245-1.htm
http://bbs.house.qq.com/t-6365262-1.htm
http://bbs.house.qq.com/t-6365299-1.htm
http://bbs.house.qq.com/t-6365332-1.htm
http://bbs.house.qq.com/t-6365358-1.htm
http://bbs.house.qq.com/t-6365383-1.htm
http://bbs.house.qq.com/t-6365401-1.htm
http://bbs.house.qq.com/t-6365423-1.htm
http://bbs.house.qq.com/t-6365445-1.htm
http://bbs.house.qq.com/t-6365487-1.htm
http://bbs.house.qq.com/t-6365503-1.htm
http://bbs.house.qq.com/t-6365519-1.htm
http://bbs.house.qq.com/t-6365540-1.htm
http://bbs.house.qq.com/t-6365567-1.htm
http://bbs.house.qq.com/t-6365595-1.htm
http://bbs.house.qq.com/t-6365629-1.htm
http://bbs.house.qq.com/t-6365702-1.htm
http://bbs.house.qq.com/t-6365722-1.htm
http://bbs.house.qq.com/t-6365746-1.htm
http://bbs.house.qq.com/t-6365766-1.htm
http://bbs.house.qq.com/t-6365794-1.htm
http://bbs.house.qq.com/t-6365816-1.htm
http://bbs.house.qq.com/t-6365840-1.htm
http://bbs.house.qq.com/t-6365858-1.htm
http://bbs.house.qq.com/t-6365886-1.htm
http://bbs.house.qq.com/t-6365922-1.htm
http://bbs.house.qq.com/t-6365945-1.htm
http://bbs.house.qq.com/t-6365958-1.htm
http://bbs.house.qq.com/t-6365981-1.htm
http://bbs.house.qq.com/t-6366010-1.htm
http://bbs.house.qq.com/t-6366039-1.htm
http://bbs.house.qq.com/t-6366103-1.htm
http://bbs.house.qq.com/t-6366146-1.htm
http://bbs.house.qq.com/t-6366159-1.htm
http://bbs.house.qq.com/t-6366183-1.htm
http://bbs.house.qq.com/t-6366200-1.htm
http://bbs.house.qq.com/t-6366216-1.htm
http://bbs.house.qq.com/t-6366242-1.htm
http://bbs.house.qq.com/t-6366262-1.htm
http://bbs.house.qq.com/t-6366284-1.htm
http://bbs.house.qq.com/t-6366314-1.htm
http://bbs.house.qq.com/t-6366341-1.htm
http://bbs.house.qq.com/t-6366368-1.htm
http://bbs.house.qq.com/t-6366402-1.htm
http://bbs.house.qq.com/t-6366427-1.htm
http://bbs.house.qq.com/t-6366465-1.htm
http://bbs.house.qq.com/t-6366492-1.htm
http://bbs.house.qq.com/t-6366508-1.htm
http://bbs.house.qq.com/t-6366525-1.htm
http://bbs.house.qq.com/t-6366548-1.htm
http://bbs.house.qq.com/t-6366573-1.htm
http://bbs.house.qq.com/t-6366592-1.htm
http://bbs.house.qq.com/t-6366616-1.htm
http://bbs.house.qq.com/t-6366629-1.htm
http://bbs.house.qq.com/t-6366653-1.htm
http://bbs.house.qq.com/t-6366677-1.htm
http://bbs.house.qq.com/t-6366690-1.htm
http://bbs.house.qq.com/t-6366718-1.htm
http://bbs.house.qq.com/t-6366738-1.htm
http://bbs.house.qq.com/t-6366762-1.htm
http://bbs.house.qq.com/t-6366779-1.htm
http://bbs.house.qq.com/t-6366795-1.htm
http://bbs.house.qq.com/t-6366808-1.htm
http://bbs.house.qq.com/t-6366830-1.htm
http://bbs.house.qq.com/t-6366866-1.htm
http://bbs.house.qq.com/t-6366896-1.htm
http://bbs.house.qq.com/t-6366920-1.htm
http://bbs.house.qq.com/t-6366934-1.htm
http://bbs.house.qq.com/t-6366952-1.htm
http://bbs.house.qq.com/t-6366967-1.htm
http://bbs.house.qq.com/t-6366984-1.htm
http://bbs.house.qq.com/t-6367010-1.htm
http://bbs.house.qq.com/t-6367027-1.htm
http://bbs.house.qq.com/t-6367044-1.htm
http://bbs.house.qq.com/t-6367058-1.htm
http://bbs.house.qq.com/t-6367074-1.htm
http://bbs.house.qq.com/t-6367091-1.htm
http://bbs.house.qq.com/t-6367107-1.htm
http://bbs.house.qq.com/t-6367121-1.htm
http://bbs.house.qq.com/t-6367133-1.htm
http://bbs.house.qq.com/t-6367148-1.htm
http://bbs.house.qq.com/t-6367160-1.htm
http://bbs.house.qq.com/t-6367175-1.htm
http://bbs.house.qq.com/t-6367190-1.htm
http://bbs.house.qq.com/t-6367202-1.htm
http://bbs.house.qq.com/t-6367214-1.htm
http://bbs.house.qq.com/t-6367231-1.htm
http://bbs.house.qq.com/t-6367256-1.htm
http://bbs.house.qq.com/t-6367282-1.htm
http://bbs.house.qq.com/t-6367294-1.htm
http://bbs.house.qq.com/t-6367308-1.htm
http://bbs.house.qq.com/t-6367360-1.htm
http://bbs.house.qq.com/t-6367383-1.htm
http://bbs.house.qq.com/t-6367397-1.htm
http://bbs.house.qq.com/t-6367422-1.htm
http://bbs.house.qq.com/t-6367437-1.htm
http://bbs.house.qq.com/t-6367454-1.htm
http://bbs.house.qq.com/t-6367475-1.htm
http://bbs.house.qq.com/t-6367487-1.htm
http://bbs.house.qq.com/t-6367505-1.htm
http://bbs.house.qq.com/t-6367519-1.htm
http://bbs.house.qq.com/t-6367535-1.htm
http://bbs.house.qq.com/t-6367550-1.htm
http://bbs.house.qq.com/t-6367566-1.htm
http://bbs.house.qq.com/t-6367579-1.htm
http://bbs.house.qq.com/t-6367594-1.htm
http://bbs.house.qq.com/t-6367622-1.htm
http://bbs.house.qq.com/t-6367639-1.htm
http://bbs.house.qq.com/t-6367661-1.htm
http://bbs.house.qq.com/t-6367698-1.htm
http://bbs.house.qq.com/t-6367737-1.htm
http://bbs.house.qq.com/t-6367784-1.htm
http://bbs.house.qq.com/t-6367812-1.htm
http://bbs.house.qq.com/t-6367856-1.htm
http://bbs.house.qq.com/t-6367881-1.htm
http://bbs.house.qq.com/t-6367894-1.htm
http://bbs.house.qq.com/t-6367912-1.htm
http://bbs.house.qq.com/t-6367938-1.htm
http://bbs.house.qq.com/t-6367968-1.htm
http://bbs.house.qq.com/t-6367987-1.htm
http://bbs.house.qq.com/t-6368021-1.htm
http://bbs.house.qq.com/t-6368064-1.htm
http://bbs.house.qq.com/t-6368082-1.htm
http://bbs.house.qq.com/t-6368447-1.htm
http://bbs.house.qq.com/t-6368480-1.htm
http://bbs.house.qq.com/t-6368503-1.htm
http://bbs.house.qq.com/t-6368517-1.htm
http://bbs.house.qq.com/t-6368541-1.htm
http://bbs.house.qq.com/t-6368573-1.htm
http://bbs.house.qq.com/t-6368599-1.htm
http://bbs.house.qq.com/t-6368620-1.htm
http://bbs.house.qq.com/t-6368634-1.htm
http://bbs.house.qq.com/t-6368648-1.htm
http://bbs.house.qq.com/t-6368709-1.htm
http://bbs.house.qq.com/t-6368724-1.htm
http://bbs.house.qq.com/t-6368737-1.htm
http://bbs.house.qq.com/t-6368754-1.htm
http://bbs.house.qq.com/t-6368798-1.htm
http://bbs.house.qq.com/t-6368811-1.htm
http://bbs.house.qq.com/t-6368824-1.htm
http://bbs.house.qq.com/t-6368873-1.htm
http://bbs.house.qq.com/t-6368890-1.htm
http://bbs.house.qq.com/t-6368905-1.htm
http://bbs.house.qq.com/t-6368921-1.htm
http://bbs.house.qq.com/t-6368953-1.htm
http://bbs.house.qq.com/t-6368990-1.htm
http://bbs.house.qq.com/t-6369006-1.htm
http://bbs.house.qq.com/t-6369028-1.htm
http://bbs.house.qq.com/t-6369051-1.htm
http://bbs.house.qq.com/t-6369073-1.htm
http://bbs.house.qq.com/t-6369092-1.htm
http://bbs.house.qq.com/t-6369109-1.htm
http://bbs.house.qq.com/t-6369180-1.htm
http://bbs.house.qq.com/t-6369224-1.htm
http://bbs.house.qq.com/t-6369251-1.htm
http://bbs.house.qq.com/t-6369271-1.htm
http://bbs.house.qq.com/t-6369283-1.htm
http://bbs.house.qq.com/t-6369318-1.htm
http://bbs.house.qq.com/t-6369339-1.htm
http://bbs.house.qq.com/t-6369353-1.htm
http://bbs.house.qq.com/t-6369374-1.htm
http://bbs.house.qq.com/t-6369430-1.htm
http://bbs.house.qq.com/t-6369451-1.htm
http://bbs.house.qq.com/t-6369475-1.htm
http://bbs.house.qq.com/t-6369497-1.htm
http://bbs.house.qq.com/t-6369523-1.htm
http://bbs.house.qq.com/t-6369539-1.htm
http://bbs.house.qq.com/t-6369552-1.htm
http://bbs.house.qq.com/t-6369566-1.htm
http://bbs.house.qq.com/t-6369580-1.htm
http://bbs.house.qq.com/t-6369593-1.htm
http://bbs.house.qq.com/t-6369608-1.htm
http://bbs.house.qq.com/t-6369625-1.htm
http://bbs.house.qq.com/t-6369640-1.htm
http://bbs.house.qq.com/t-6369655-1.htm
http://bbs.house.qq.com/t-6369699-1.htm
http://bbs.house.qq.com/t-6369722-1.htm
http://bbs.house.qq.com/t-6369738-1.htm
http://bbs.house.qq.com/t-6369771-1.htm
http://bbs.house.qq.com/t-6369809-1.htm
http://bbs.house.qq.com/t-6369824-1.htm
http://bbs.house.qq.com/t-6369873-1.htm
http://bbs.house.qq.com/t-6369919-1.htm
http://bbs.house.qq.com/t-6369933-1.htm
http://bbs.house.qq.com/t-6369950-1.htm
http://bbs.house.qq.com/t-6369967-1.htm
http://bbs.house.qq.com/t-6370020-1.htm
http://bbs.house.qq.com/t-6370040-1.htm
http://bbs.house.qq.com/t-6370056-1.htm
http://bbs.house.qq.com/t-6370069-1.htm
http://bbs.house.qq.com/t-6370088-1.htm
http://bbs.house.qq.com/t-6370129-1.htm
http://bbs.house.qq.com/t-6370146-1.htm
http://bbs.house.qq.com/t-6370157-1.htm
http://bbs.house.qq.com/t-6370190-1.htm
http://bbs.house.qq.com/t-6370232-1.htm
http://bbs.house.qq.com/t-6370245-1.htm
http://bbs.house.qq.com/t-6370259-1.htm
http://bbs.house.qq.com/t-6370272-1.htm
http://bbs.house.qq.com/t-6370297-1.htm
http://bbs.house.qq.com/t-6370312-1.htm
http://bbs.house.qq.com/t-6370368-1.htm
http://bbs.house.qq.com/t-6370398-1.htm
http://bbs.house.qq.com/t-6370414-1.htm
http://bbs.house.qq.com/t-6370438-1.htm
http://bbs.house.qq.com/t-6370456-1.htm


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template