当前位置:网站首页>2D动画的一个场景应用
2D动画的一个场景应用
2022-07-19 16:51:00 【我若成魔,佛赖我何,我就是程序狂魔】
HTML代码
<section>
<div class="stage">
<div class="skyline"></div>
<div class="beans"></div>
<div class="ground back"></div>
<div class="ground mid"></div>
<div class="ground front"></div>
<div class="dowEventCenter"></div>
<div class="planetarium"></div>
<div class="friendshipShell"></div>
<div class="glockenspiel"></div>
<!--汽球-->
<div class="balloon"></div>
</div>
</section>
CSS代码
body {margin:0; padding:0; background-color:#ddf5f7;}
/*-------- 天空背景以及动画 --------*/
.stage {
position: relative;
overflow: hidden;
height: 600px;
background: #ddf5f7;
animation: beijing 20s infinite linear;
}
/* 背景色改变 */
@keyframes beijing{
0%{
background: lightblue;
}
25%{
background: peachpuff;
}
50%{
background: slateblue;
}
75%{
background: darkgrey;
}
100%{
background: lightblue;
}
}
/*-------- 气球以及动画 --------*/
.balloon {
position: absolute;
z-index: 3;
top: 5%;
right: -157px;
background: url(images/balloon.png) no-repeat no-repeat center;
height: 227px;
width: 157px;
/* 先给需要的动画起个名字 在设置运动轨迹 infinite ease alternate 循环先慢在快轮流交换 */
animation: qiqiu 20s infinite ease alternate;
}
/* 气球的动画效果用关键针@keyframes transform:rotate()旋转函数; */
@keyframes qiqiu{
0%{
right: -157px;
transform: rotate(0deg);
}
25%{
right: 25%;
transform: rotate(30deg);
}
50%{
right: 50%;
transform: rotate(60deg);
}
75%{
right: 75%;
transform: rotate(30deg);
}
100%{
right: 100%;
transform: rotate(0deg);
}
}
/*-------- 城市场景图片 --------*/
.skyline {
position: absolute;
z-index: 5;
width: 100%;
bottom: 26%;
background: url(images/skyline.png) repeat no-repeat;
height: 147px;
}
.beans {
position: absolute;
z-index: 4;
height: 201px;
width: 88px;
bottom: 30%;
left: 50%;
background: url(images/beans.png) no-repeat no-repeat;
}
.ground {
position: absolute;
width: 100%;
bottom: 0;
}
.ground.front {
z-index: 30;
background: url(images/groundFront.png) repeat no-repeat center;
height: 301px;
}
.ground.mid {
z-index: 20;
background: url(images/groundMid.png) repeat no-repeat;
height: 299px;
}
.ground.back {
z-index: 10;
background: url(images/groundBack.png) repeat no-repeat center;
height: 281px;
}
.dowEventCenter {
position: absolute;
z-index: 12;
bottom: 20%;
left: 5%;
background: url(images/dowEventCenter.png) no-repeat no-repeat center;
height: 236px;
width: 524px;
}
.planetarium {
position: absolute;
z-index: 12;
bottom: 18%;
right: 10%;
background: url(images/Planetarium.png) no-repeat no-repeat center;
height: 285px;
width: 347px;
}
.friendshipShell {
position: absolute;
z-index: 21;
bottom: 18%;
left: 20%;
background: url(images/friendshipShell.png) no-repeat no-repeat center;
height: 370px;
width: 231px;
}
.glockenspiel {
position: absolute;
z-index: 11;
bottom: 26%;
right: 50%;
background: url(images/Glockenspiel.png) no-repeat no-repeat center;
height: 263px;
width: 137px;
}
</style>
动画效果
边栏推荐
- Invalid values in MATLAB fill image
- [problem solving] uncaught typeerror: cannot read property 'addListener' of undefined when wechat developer tools introduce components
- 查询端口占用 并关闭
- 文件操作-
- Matlab数组A中删除数组B的元素
- WPF 属性触发器
- WPF 密码框 密码可见切换
- JVM 上数据处理语言的竞争:Kotlin, Scala 和 SPL
- Summary of common browser compatibility problems and Solutions
- 数据查询必备技能SQL调优:Mysql什么情况下不走索引
猜你喜欢
IIS上部署webService
WPF DataGrid 两行一个颜色
Matlab TRMM_ 3b42 data format conversion (NC to TIF, with code)
Go language environment construction and samples
Arcpy batch conversion data projection (taking Albers as an example)
ArcGIS custom coordinate system (taking Albers as an example)
Build yourself an extremely simple but easy-to-use shame map station
Quickly extract tables from PDF files
单片机调试 — Event Recorder 的使用
Go fastdfs distributed file system construction (implementation sorting)
随机推荐
Matlab与1stOpt多元非线性回归
MATLAB realizes the wind speed conversion of tropical cyclone in different wind periods
Pychart debug error "process finished with exit code -1073741819 (0xc0000005)" solution
Matlab cell保存为.csv格式
【问题解决】负载均衡问题
MATLAB realizes LMDI decomposition method (including zero value processing)
oracle建表语句模板
MATLAB绘制环形比例图
C# linq查询集合后 返回var 转换成实体类集合
第十章:线程
MSWEP数据nc格式转tif格式
STM32F103C8T6 操作矩阵键盘
ArcGIS导出地图后部分图例不显示
【数组基础的增,删,改,查】
How to solve the user name enumeration vulnerability
Matlab实现热带气旋不同风期的风速转换
Matlab填充影像中的无效值
WPF DataGrid MVVM 绑定 SelectedCells
Ceph在手天下我有!
Arcpy batch conversion data projection (taking Albers as an example)