learning_cesium/缩放过度动画.html

83 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<style>
body {
background-color: rgb(223, 223, 223);
}
.list {
margin-top: 50px;
margin-left: 50px;
background-color: rgb(29, 156, 29);
width: 150px;
height: 150px;
transition: 0.5s; /* 缩放动画特效时间*/
text-align: center;
color: white;
line-height: 140px;
overflow: hidden;
/* 默认隐藏 */
}
/* 鼠标移入,缩放 */
/*
scalex()水平方向缩放
scaley()垂直方向缩放
scale()双方向缩放,以1为单位放大和缩小
*/
.list:hover {
transform: scale(1.2);
}
/* 定义动画 */
@keyframes test {
from {
margin-left: 0;
transform: scale(1);
}
/* from表示动画的开始位置 也可以使用0% */
to {
margin-left: 700px;
background-color: red;
transform: scale(0.3,0.5) translateX(-50%);
}
/* to表示动画结束位置 也可以使用100% */
}
.picture {
animation: test 2s;
margin-top: 50px;
margin-left: 50px;
width: 550px;
height: 350px;
transition: 0.5s;
text-align: center;
color: white;
line-height: 340px;
background-color: rgb(233, 135, 135);
}
.img {
width: 100%;
height: 100%;
}
.picture:hover {
transform: scale(2);
/* 以1为单位放大和缩小 */
}
</style>
<body>
<div class="list">缩放动画效果</div>
<div class="picture">
<img src="https://www.baidu.com/img/flexible/logo/pc/result.png" />
</div>
</body>
</html>