欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

transition和animation怎么在CSS3中使用

今天就跟大家聊聊有關(guān)transition和animation怎么在CSS3中使用,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結(jié)了以下內(nèi)容,希望大家根據(jù)這篇文章可以有所收獲。

成都創(chuàng)新互聯(lián)公司是專業(yè)的和碩網(wǎng)站建設公司,和碩接單;提供成都做網(wǎng)站、網(wǎng)站設計、外貿(mào)營銷網(wǎng)站建設,網(wǎng)頁設計,網(wǎng)站設計,建網(wǎng)站,PHP網(wǎng)站建設等專業(yè)做網(wǎng)站服務;采用PHP框架,可快速的進行和碩網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!

transition

transition 屬性是
transition-property,
transition-duration,
transition-timing-function,
transition-delay
的簡稱,用于設定一個元素的兩個狀態(tài),不同的狀態(tài)可以用偽類,比如:hover, :active 或者是通過 javascript 動態(tài)設定。IE10+支持。

所以 transition 的初始值為:

transition-delay: 0s;
transition-duration: 0s;
transition-property: all;
transition-timing-function: ease;

用法

div {
transition: <property> <duration> <timing-function> <delay>;
}

并且有事件可以監(jiān)測 transition 結(jié)束

el.addEventListener("transitionend",updateTransition,true);

//in webkit
el.addEventListener("webkitTransitionEnd",updateTransition,true);

實例

HTML

代碼如下:


<!-- DEMO 1: Fade Block -->
<div id="fade">
move here !
</div>
<div id="nudge">
mouse on me
</div>
<div id="bounce">Place mouse on me i will bounce!</div>
<div id="spin">Place mouse on me i won me i won me i won me i won me i won me i won me i won me i won me i won me i won me i won me i won me i won me i won me i will spin</div>
<div id="accordion" class="accordion">
<a href="#first">This is first tab</a>
<div id="first"><p>Lorem ipsum </p> </div>
<a href="#second">This is second tab</a>
<div id="second"><p>Lorem ipsum </p> </div>
<a href="#third">This is third tab</a>
<div id="third"><p>Lorem ipsum </p> </div>
</div>


CSS

代碼如下:


/*
DEMO 1: Fade Block
*/
div {
margin-bottom: 50px;
}
#fade {
/*opacity:1;
-webkit-transition: opacity 10s liner 10s;*/
position: relative;
transition-property: font-size;
transition-duration: 0.5s;
transition-delay: 0;
font-size: 14px;
}
#fade:hover {
font-size: 36px;
}

/* DEMO2 */
#nudge{
-webkit-transition-property: color,
background-color,padding-left;
-webkit-transition-duration: 500ms,500ms, 500ms;
}
#nudge:hover{
background-color: #efefef;
color: #333;
padding-left: 50px;
}
#bounce:hover {
-webkit-animation-name:bounce;
-webkit-animation-duration:1s;
-webkit-animation-iteration-count:2;
-webkit-animation-direction:alternate
}
@-webkit-keyframes bounce {
from{margin-left:0;}
to{margin-left:250px;}
}
#spin{
-webkit-transition: -webkit-transform 10s ease-in;
}
#spin:hover{
-webkit-transform: rotate(36000deg);
}
.accordion a{
display: block;
padding:5px 10px;
background-color:#ccc;
color:#000;
/*可以去掉鏈接的下劃線等修飾效果*/
text-decoration:none;
}
.accordion a:hover{
background-color:#999;
}
.accordion div{
background-color:#cda;
color:#222;
}
.accordion div p{
padding:20px
}
#accordion div{
/*先隱藏起來*/
height:0;
overflow:hidden;
-webkit-transition:height 600ms ease;
}
#accordion div:target{
height:110px;
}


animation

animation 屬性是如下這些屬性的簡寫 
animation-name: none 
animation-duration: 0s 
animation-timing-function: ease 
animation-delay: 0s 
animation-iteration-count: 1 
animation-direction: normal 
animation-fill-mode: none
用法
 
animation: 
animation-name 
time(duration) 
timing-function 
time(delay) 
animation-iteration-count( 結(jié)束之前的循環(huán)次數(shù)) 
single-animation-direction 
/*{ 
animation-direction: normal (每次從正方向開始) 
animation-direction: reverse (每次從反方向開始) 
animation-direction: alternate (正反往復) 
}*/ 
single-animation-fill-mode



實例

<div class="view_port"> 
<div class="polling_message"> 
Listener for dispatches 
</div> 
<div class="cylon_eye"> 
</div> 
</div> 
.polling_message { 
color: white; 
float: left; 
margin-right:2%; 
} 
.view_port { 
background-color: black; 
height: 50px; 
width: 100%; 
overflow: hidden; 
} 
.cylon_eye { 
color: white; 
height: 100%; 
width: 80%; 
background-color: red; 
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.9) 25%, rgba(0, 0, 0, 0.1) 50%, rgba(0, 0, 0, 0.9) 75%); 
-webkit-animation: move_eye 4s linear 0s infinite alternate; 
-moz-animation: move_eye 4s linear 0s infinite alternate; 
-o-animation: move_eye 4s linear 0s infinite alternate; 
animation: move_eye 4s linear 0s infinite alternate; 
} 
@-webkit-keyframes move_eye { 
from { 
margin-left:-20%; 
} 
to { 
margin-left:100%; 
} 
} 
@-moz-keyframes move_eye { 
from { 
margin-left:-20%; 
} 
to { 
margin-left:100%; 
} 
} 
@-o-keyframes move_eye { 
from { 
margin-left:-20%; 
} 
to { 
margin-left:100%; 
} 
} 
@keyframes move_eye { 
from { 
margin-left:-20%; 
} 
to { 
margin-left:100%; 
} 
}

看完上述內(nèi)容,你們對transition和animation怎么在CSS3中使用有進一步的了解嗎?如果還想了解更多知識或者相關(guān)內(nèi)容,請關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝大家的支持。

新聞標題:transition和animation怎么在CSS3中使用
URL鏈接:http://chinadenli.net/article46/ipcphg.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供微信小程序小程序開發(fā)品牌網(wǎng)站制作網(wǎng)站改版網(wǎng)頁設計公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運營