svg+js实现视觉差异立体鱼塘金鱼游动动画效果代码
代码语言:html
所属分类:视觉差异
代码描述:svg+js实现视觉差异立体鱼塘金鱼游动动画效果代码
代码标签: svg js 视觉差异 立体 鱼塘 金鱼 游动 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
HTML {
overflow: hidden;
}
body {
margin: 0;
width: 100%;
height: 100%;
}
.page {
width: 100vw;
height: 100vh;
background-color: #fff;
color: #fff;
font-weight: bold;
text-align: center;
padding: 30px;
}
.cls-1 {
fill: #8dcbdc;
}
.cls-2 {
fill: #fff;
}
.cls-3 {
fill: #68bad1;
}
.cls-4 {
fill: #00559c;
}
.cls-5 {
fill: #3aa5c2;
}
.cls-6 {
fill: #2a8bbe;
}
svg {
display: block;
width: 500px;
height: 500px;
fill: #fff;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow: hidden;
}
svg.base {
transform: translate(-50%, -50%) perspective(200px) translateZ(-200px);
}
svg.cover {
transform: translate(-50%, -50%) perspective(200px) translateZ(75px);
}
svg .fish {
filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.5));
transform-origin: 250px 250px;
animation-name: fishAll;
animation-duration: 80s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
svg .fish2 {
transform-origin: 250px 250px;
animation-name: fishAll2;
animation-duration: 80s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
svg .fish2 .fish-body {
animation-direction: alternate-reverse;
}
svg .fish2 .fish-tail {
animation-direction: alternate;
}
svg .fish-body {
fill: #e74e19;
transform-origin: 327.66px 264.13px;
animation-name: fishSwim;
animation-direction: alternate;
animation-timing-function: ease-in;
animation-duration: 2.5s;
animation-iteration-count: infinite;
}
svg .fish-tail {
fill: #dc4817;
transform-origin: 327.66px 264.13px;
animation-name: fishSwim;
animation-direction: alternate-reverse;
animation-timing-function: ease-in;
animation-duration: 2.5s;
animation-iteration-count: infinite;
}
svg:nth-child(1) {
filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.5));
transform: translate(-50%, -50%) perspective(200px) translateZ(-160px);
transition: transform 0.1s;
}
svg:nth-child(2) {
filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.5));
transform: translate(-50%, -50%) perspective(200px) translateZ(-120px);
transition: transform 0.1s;
}
svg:nth-child(3) {
filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.5));
transform: translate(-50%, -50%) perspective(200px) translateZ(-80px);
transition: transform 0.1s;
}
svg:nth-child(4) {
filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.5));
transform: translate(-50%, -50%) perspective(200px) translateZ(-40px);
transition: transform 0.1s;
}
svg:nth-child(5) {
filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.5));
transform: translate(-50%, -50%) perspective(200px) translateZ(0px);
transition: transform 0.1s;
}
@keyframes fishSwim {
0% {
transform: rotate(-10deg);
}
100% {
transform: rotate(10deg);
}
}
@keyframes fishAll {
0% {
transform: rotate(0);
}
100% {
transform: rotate(-360deg);
}
}
@keyframes fishAll2 {
0% {
transform: rotate(115deg);
}
100% {
transform: rotate(-475deg);
}
}
</style>
</head>
<body >
<div class="page">
<div class="svg-wrap">
<svg class="base" viewBox="0 0 500 500">
<g class="paths">
<rect class="cls-4" y="0.25" width="500" height="500"/>
</g>
</svg>
<svg class="move" viewBox="0 0 500 500">
<g class="paths">
<path class="cls-6" d="M0,0V500H500V0ZM406.35,244.87c-9.18,11.87-29.12,11.83-36.83,24.71-11.65,19.47,16.11,46.11,4.26,65.46-7,11.4-24.44,13.19-30.57,25.07-4.37,8.45-1.27,18.82-3.29,28.12-6.92,31.88-48.53,24.94-69.85,15.34-19.14-8.61-38.57-20.32-59.43-18.07-10.95,1.19-2.........完整代码请登录后点击上方下载按钮下载查看
网友评论0