css animate不循环怎么办

css animate不循环怎么办,第1张

css animate不循环怎么办

css中可利用animation-iteration-count属性来解决animate不循环问题,该属性定义动画的播放次数,只需要给动画设置“animation-iteration-count:infinite;”样式即可实现无限次循环。

本教程 *** 作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

css中animate不循环,可利用animation-iteration-count属性来解决。

例如:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<style>
			div {
				width: 100px;
				height: 100px;
				background: pink;
				margin: 100px;
				animation: mymove 5s;
				-webkit-animation: mymove 5s; /* Safari and Chrome */
			}

			@keyframes mymove {
				50% {
					transform: rotate(360deg);
				}

			}

			@-webkit-keyframes mymove{  /* Safari and Chrome */
				50% {
					transform: rotate(360deg);
				}

			}
		</style>
	</head>
	<body>
		<div></div>
	</body>
</html>

只正反旋转溢出,没有循环实现旋转,这要怎么做?简单,就利用animation-iteration-count属性来解决。

div {
	width: 100px;
	height: 100px;
	background: pink;
	margin: 100px;
	animation: mymove 5s;
	-webkit-animation: mymove 5s; /* Safari and Chrome */
	animation-iteration-count:infinite;
	-webkit-animation-iteration-count:infinite;/* Safari and Chrome */
}

说明:

使用animation-iteration-count属性定义动画的播放次数。语法:

animation-iteration-count: value;
值描述n一个数字,定义应该播放多少次动画infinite指定动画应该播放无限次(永远)

(学习视频分享:css视频教程)

以上就是css animate不循环怎么办的详细内容,

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/699084.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-22
下一篇 2022-04-22

发表评论

登录后才能评论

评论列表(0条)

保存