Loading等待动画(waiting animation)

北慕城南 提交于 2020-01-28 04:14:46

Loading等待动画

示例

在这里插入图片描述

HTML

<div class="logo"></div>
<div class="star">
	<div class="point"></div>
	<div class="point"></div>
	<div class="point"></div>
	<div class="point"></div>
	<div class="point"></div>
</div>

CSS

$length: 3rem;
$width: 1rem;
$depth: 1.4rem;
$color: white;


html {
	font-size: 20px; // raise this value to scale the star
	overflow: hidden;
	padding: 0; margin: 0;
}


body {
	background: #222;
	overflow: hidden;
	padding: 0; margin: 0;
}


.logo {
	background-image: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/42746/ds_logo.png);
	height: 50vh;
	width: 100vw;
	background-repeat: no-repeat;
	background-position: center 0.5rem;
	background-size: contain;
}


.star {
	height: 5rem;
	width: 5rem;
	position: fixed;
	top: 50%;
	left: 50%;
	transform: translateZ(0) translateX(-50%) translateY(-50%);
}


.point {
	position: absolute;
	height: 0.1rem;
	width: 0.1rem;
	top: 0;
	left: 50%;
	top: 50%;
	transform-origin: bottom center;
	animation: pulseFade 2.5s infinite;
}




.point:before,
.point:after {
	display: block;
	content: '';
	width: 0;
	height: 0;
	bottom: 0.1rem;
	border-style: solid;
	position: absolute;
}


.point:before {
	border-width: $length 0 $depth $width;
	border-color: transparent transparent transparent $color;
	left: 0.035rem;
}


.point:after {
	border-width: $length $width $depth 0;
	border-color: transparent $color transparent  transparent;
	left: calc(-#{$width} + 0.035rem);
}


.point:nth-child(1) {
	transform: translateZ(0);
	animation-delay: -2.5s;
}
 
.point:nth-child(2) {
	transform: translateZ(0) rotate(72deg);
	animation-delay: -2s;
}


.point:nth-child(3) {
	transform: translateZ(0) rotate(144deg);
	
	animation-delay: -1.5s;
}


.point:nth-child(4) {
	transform: translateZ(0) rotate(216deg);
	animation-delay: -1s;
}


.point:nth-child(5) {
	transform: translateZ(0) rotate(288deg);
	animation-delay: -0.5s;
}


@keyframes pulseFade {
	0% {
		opacity: 0;
	}
	
	2% {
		opacity: 0.6;
	}
	
	4% {
		opacity: 0.4;
	}
	
	6% {
		opacity: 0.8;
	}
	
	8% {
		opacity: 0.4;
	}
	
	10% {
		opacity: 1;
	}
	
	80% {
		opacity: 0;
	}
	
	100% {
		opacity: 0;
	}
}
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!