您好,登錄后才能下訂單哦!
1.transition動畫
(1)transition-property 設置過渡的屬性,比如:width height background-color
(2)transition-duration 設置過渡的時間,比如:1s 500ms
(3)transition-timing-function 設置過渡的運動方式,常用有l(wèi)inear(勻速)| ease(緩沖運動)
(4)transition-delay 設置動畫的延遲
(5)transition:property duration timing-function delay; 同時設置
<head>
<meta charset="utf-8">
<title>transition動畫</title>
<style type="text/css">
.box{
width: 100px;
height: 100px;
background-color: yellow;
transition: all 500ms ease,background-color 2s ease;
}
.box:hover{
width: 500px;
height: 500px;
background-color: red;
}
</style>
</head>
<body>
<div class="box"></div>
</body>
例子二:圖片說明文字
<head>
<meta charset="utf-8">
<title>圖片</title>
<style type="text/css">
.box{
width: 320px;
height: 405px;
margin: 50px auto 0;
position: relative;
overflow: hidden;
}
.text{
width: 320px;
height: 100px;
position: absolute;
top: 405px;
background-color: rgba(124,119,119,0.30);
transition: all 500ms ease;
}
.box:hover .text{
position: absolute;
top: 305px;
}
</style>
</head>
<body>
<div class="box">
<img src="images/3_02.png" alt="星空">
<div class="text">
<h4>夜空中最亮的星</h4>
<p>我在思考人生</p>
</div>
</div>
</body>
例子三:夏目
<head>
<meta charset="utf-8">
<title>joke</title>
<style type="text/css">
@keyframes joke{
from{
left: 0px;
}
to{
left: -2136px; /*圖片寬度*/
}
}
.box{
width: 534px;
height: 300px;
margin: 50px auto;
overflow: hidden;
position: relative;
}
.box img{
position: absolute;
animation: joke 1s steps(4) infinite;
}
</style>
</head>
<body>
<div class="box">
<img src="images/xia.png" alt="夏目友人帳">
</div>
</body>
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內容。