HTML简单动画制作

HTML简单动画制作(圆移动变色)

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
	<style>
		.circle{
			width: 100px;
			height: 100px;
			border-radius: 50%;
			position: absolute;
			background-color: red;

			animation-name: x;
			animation-timing-function: linear;
			animation-iteration-count: infinite;
			animation-duration: 7s;
			animation-direction: alternate;
		}

		.circle:hover{
			animation-play-state: paused;
		}

		@keyframes x{
			0%{
				left: 0px;
			}
			18%{
				left: 200px;
				background-color: orange;
			}
			36%{
				left: 400px;
				background-color: yellow;
			}
			54%{
				left: 600px;
				background-color: lightgreen;
			}
			72%{
				left: 800px;
				background-color: teal;
			}
			85%{
				left: 1000px;
				background-color: lightblue;
			}
			100%{
				left: 1200px;
				background-color: purple;
			}
		}
	</style>
</head>
<body>
	<div class="circle">
		
	</div>
</body>
</html>

动画效果

这就是以上代码展现出的动画效果
下一篇博客写一个相对更复杂一点的动画页面~想你们哦 小可爱们 嘻嘻~

在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值