动画效果

一、动画

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>动画</title>
	<style type="text/css">

		/* 声明动画 */
		@keyframes move {
			from {
				background-color: pink;
				left: 0;
			}

			to {
				background-color: yellow;
				left: 1000px;
			}
		}
		
		div {
			width: 300px;
			height: 300px;
			background-color: pink;
			position: absolute;
			left: 0;
			/* 调用动画 */
			/* animation: 动画名称 花费时间 运动曲线 何时开始 播放次数 是否反方向; 
				
				normal - 动画正常播放(向前)。默认值
				reverse - 动画以反方向播放(向后)
				alternate - 动画先向前播放,然后向后
				alternate-reverse - 动画先向后播放,然后向前

			*/
			animation: move 3s ease 0s infinite alternate;
		}

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

二、动画旋转

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style type="text/css">
		* {
			padding: 0;
			margin: 0;
		}

		div {
			width: 214px;
			height: 214px;
			position: relative;
			left: 0;
			top: 0;
		}

		div img {
			position: absolute;
			left: 0;
			top: 0;
			animation: rotate 1s linear infinite;
			/* animation-name: rotate;
			animation-duration: 1s;
			animation-timing-function: linear;
			animation-iteration-count: infinite; */
		}
		
		div p {
			width: 100%;
			height: 100%;
			position: absolute;
			left: 0;
			padding: 0;
			text-align: center;
			line-height: 214px;
		}

		@keyframes rotate {
			0% {
				transform: rotate(0deg);
			}

			50% {
				transform: rotate(180deg);
			}

			100% {
				transform: rotate(360deg);
			}
		}


	</style>
</head>
<body>
	<div>
		<img src="img/web.png" />
		<p>giserDev</p>
	</div>
</body>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值