svg+css+js实现水晶球中水中垂钓钓鱼loading加载动画效果代码

代码语言:html

所属分类:加载滚动

代码描述:svg+css+js实现水晶球中水中垂钓钓鱼loading加载动画效果代码

代码标签: svg css js 水晶球 水中 垂钓 钓鱼 loading 加载 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
<style>
    /* 引入字体库 */
@import url('https://fonts.googleapis.com/css?family=Montserrat:300,400,700');

/* 对于标签样式调整 */
* {
	padding: 0;
	margin: 0;
	position: relative;
}

/* 主体的背景和字体 */
body {
	background: #fff5df;
	font-family: 'Montserrat', sans-serif;
}

/* 父,对整体进行调整 */
.all {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	/* 缩小 */
	transform: scale(.75);
}

/* 子 */
.bowl {
	width: 250px;
	height: 250px;
	border: 5px solid #fff;
	border-radius: 50%;
	position: fixed;
	top: calc(50% - 125px);
	left: calc(50% - 125px);
	background: rgba(90, 201, 226, 0.3);
}

/* 容器的阴影 */
.bowl:before {
	content: "";
	position: absolute;
	bottom: -25px;
	left: 50px;
	width: 150px;
	height: 50px;
	border-radius: 50%;
	background: rgba(0,0,0,0.15);
}

/* 容器口 */
.bowl:after {
	content: "";
	position: absolute;
	top: 10px;
	left: calc(25% - 3px);
	width: 50%;
	height: 40px;
	border: 3px solid #fff;
	border-radius: 50%;
}

/* 调整整体位置 */
.bowl .water {
	position: absolute;
	bottom: 5%;
	left: 0;
	width: 100%;
	height: 50%;
	overflow: hidden;
	/* 添加水的动画 */
	animation: top-inner 5s ease infinite;
}

@keyframes top-inner {
	from {
		transform: rotate(0deg);
		margin-left: 0px;
	}
	25% {
		transform: rotate(3deg);
		margin-left: -3px;
	}
	50% {
		transform: rotate(-6deg);
		margin-left: 6px;
	}
	75% {
		transform: rotate(5deg);
		margin-left: -5px;
	}
	to {
		transform: rotate(0deg);
		margin-left: 0px;
	}
}

/* 容器中的水 */
.bowl .water .inner {
	width: 225px;
	height: 225px;
	border-radius: 50%;
	background: #4e99ce;
	position: absolute;
	bottom: 0;
	left: 12.5px;
}

/* 为了使水立体 */
.bowl .top-water {
	position: absolute;
	width: 225px;
	height: 60px;
	border-radius: 50%;
	background: #82bde6;
	bottom: 105px;
	left: 12.5px;
	/* 添加动画 */
	animation: top 5s ease infinite;
}

/* 与上面动画保持一致,如果不一致,刷新一下  */
@keyframes top {
	from {
		transform: rotate(0deg);
	}
	25% {
		transform: rotate(3deg);
	}
	50% {
		transform: rotate(-6deg);
	}
	75% {
		transform: rotate(5deg);
	}
	to {
		transform: rotate(0deg);
	}
}
/* 至此,容器和水就完成了~ */

/* 待全部画完后就可以添加动画了,添加后人物就在容器中了 */
.center-box {
	height: 400px;
	width: 400px;
	position: fixed;
	top: calc(50% - 250px);
	left: calc(50% - 180px);
  /* 添加动画 */
  animation: float 5s ease infinite;
	transform: scale(0.5);
}

@keyframes float {
	from {
		transform: translate(0, 0px) scale(0.25);
	}
	25% {
		transform: translate(0, 4px) scale(0.25);
	}
	50% {
		transform: translate(0, -7px) scale(0.25);
	}
	75% {
		transform: translate(0, 7px) scale(0.25);
	}
	to {
		transform: translate(0, -0px) scale(0.25);
	}
}

/* 渔民 */
.fisherman {
	width: 400px;
	height: 300px;
}

/* 身体 */
.fisherman .body {
	width: 80px;
	height: 150px;
	background: #d2bd24;
	position: absolute;
	bottom: 15px;
	right: 40px;
	-webkit-clip-path: ellipse(40% 50% at 0% 50%);
	clip-path: ellipse(40% 50% at 0% 50%);
	transform: rotate(-20deg);
}

.fisherman .body:before {
	content: "";
	width: 80px;
	height: 200px;
	background: #d2bd24;
	position: absolute;
	bottom: -10px;
	right: 15px;
	-webkit-clip-path: ellipse(90% 50% at 0% 50%);
	clip-path: ellipse(90% 50% at 0% 50%);
	transform: rotate(10deg);
}

/* 右胳膊 */
.fisherman .right-arm {
	width: 20px;
	height: 110px;
	background: #d2bd24;
	border-radius: 20px;
	position: absolute;
	bottom: 46px;
	right: 163px;
	transform: rotate(40deg);
}

.fisherman .right-arm:before {
	content: "";
	background: #ffd1b5;
	width: 25px;
	height: 25px;
	position: absolute;
	top: 82px;
	right: 50px;
	border-radius: 20px;
}

.fisherman .right-arm:after {
	content: "";
	width: 20px;
	height: 50px;
	background: #d2bd24;
	border-radius: 20px;
	position: absolute;
	bottom: -15px;
	right: 20px;
	transform: rotate(-80deg);
	border-top-left-radius: 0px;
	border-top-right-radius: 0px;
}

/* 右腿 */
.fisherman .right-leg {
	width: 20px;
	height: 110px;
	backgr.........完整代码请登录后点击上方下载按钮下载查看

网友评论0