svg+css实现一条水中游动呼吸的鱼儿动画效果代码
代码语言:html
所属分类:动画
代码描述:svg+css实现一条水中游动呼吸的鱼儿动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
:root {
--dark: #002C9B;
--light: #C8DFFF;
}
body {
height: 100vh;
width: 100vw;
display: grid;
place-items: center;
background: #0069FF;
}
.wrapper {
animation: fish 1.5s ease infinite alternate;
transform: translate(-4px, -2px);
}
@keyframes fish {
from {
transform: translate(-4px, -2px);
}
to {
transform: translate(0px, 0px) rotate(1deg);
}
}
.bod {
color: var(--light);
transform-origin: 0 50%;
animation: bod 1.5s ease infinite alternate;
}
@keyframes bod {
from {
transform: translateX(0px) scalex(1);
}
to {
transform: translateX(0.25px) scalex(0.98);
}
}
.eye {
color: var(--dark);
}
.fin-tail {
color: var(--dark);
transform-origin: 200px;
animation: tail 1.5s 1.5s ease infinite alternate;
}
@keyframes tail {
from {
transform: scaleX(1) rotate(0deg);
}
to {
transform: scaleX(0.75) rotate(3deg);
}
}
.fin-back-bottom {
color: var(--dark);
transform-origin: 155px;
animation: fin-bottom 1.5s ease infinite alternate;
}
.fin-front-bottom {
color: var(--dark);
transform-origin: 76px;
animation: fin-bottom 1.5s ease infinite alternate;
}
@keyframes fin-bottom {
from {
transform: rotate(-4deg) scaleY(0.98);
}
to {
transform: rotate(0deg) scaleY(1);
}
}
.fin-front-top {
color: var(--dark);
transform-origin: 80px;
animation: fin-front 1.5s ease infinite alternate;
}
@keyframes fin-front {
from {
transform: rotate(0deg) scaleX(1);
}
to {
transform: rotate(-8deg) scaleX(0.55);
}
}
.fin-dorsel {
color: var(--dark);
transform-origin: 80px;
animation: fin-top 1.5s ease infinite alternate;
transform: rotate(2deg) translate(2px, 3px);
}
.fin-back-top {
color: var(--dark);
transform-origin: 145px;
animation: fin-top 1.5s ease infinite alternate;
}
@keyframes fin-top {
from {
transform: rotate(2deg) translate(2px, 3px);
}
to {
transform: rotate(0deg) translate(0px, 0px);
}
}
</style>
</head>
<body>
<div class="wrapper">
<svg width="240" height="99" viewBox="0 0 240 99" fill="none" xmlns="http://www.w3.org/2000/svg">
<path class="fin-tail" d="M228.47 36.1471C230.769 31.1344 232.184 25.7614 232.651 20.266C232.702 19.7482.........完整代码请登录后点击上方下载按钮下载查看
网友评论0