纯css实现海底鱼儿游玩动画效果
代码语言:html
所属分类:动画
代码描述:纯css实现海底鱼儿游玩动画效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
* {
padding: 0;
margin: 0 auto;
box-sizing: border-box;
}
body {
background-color: #bdf;
min-height: 100vh;
}
.fish {
position: fixed;
top: 200px;
width: 110px;
height: 90px;
background-color: var(--fColor);
background-image: -webkit-gradient(linear, right top, left top, from(var(--fColor)), color-stop(50%, transparent)), -webkit-gradient(linear, left top, left bottom, from(transparent), color-stop(30%, rgba(255, 255, 255, 0.3)), to(rgba(0, 0, 0, 0.3)));
background-image: linear-gradient(270deg, var(--fColor), transparent 50%), linear-gradient(transparent, rgba(255, 255, 255, 0.3) 30%, rgba(0, 0, 0, 0.3));
border-radius: 50%;
-webkit-transform: rotate(30deg) translateX(-50%);
transform: rotate(30deg) translateX(-50%);
-webkit-filter: blur(1px) drop-shadow(0 0 10px rgba(0, 0, 0, 0.25));
filter: blur(1px) drop-shadow(0 0 10px rgba(0, 0, 0, 0.25));
-webkit-animation: swim 20s var(--fishDelay) linear infinite;
animation: swim 20s var(--fishDelay) linear infinite;
}
.fish:nth-child(1) {
--swimX: -30%;
--fishDelay: -10s;
--fColor: #880E4F;
}
.fish:nth-child(2) {
--swimX: -10%;
--fishDelay: -2s;
--fColor: #B71C1C;
}
.fish:nth-child(3) {
--swimX: 10%;
--fishDelay: -12s;
--fColor: #BF360C;
}
.fish:nth-child(4) {
--swimX: 30%;
--fishDelay: -4s;
--fColor: #E65100;
}
.fish:nth-child(5) {
--swimX: 50%;
--fishDelay: -14s;
--fColor: #FF6F00;
}
.fish:nth-child(6) {
--swimX: 70%;
--fishDelay: -6s;
--fColor: #F57F17;
}
.fish:nth-child(7) {
--swimX: 90%;
--fishDelay: -16s;
--fColor: #827717;
}
.fis.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0