CSS3太极旋转图与3D旋转图片

1.太极旋转图

<style type="text/css">
			main{
				width: 300px;
				height: 150px;
				background-color: #000000;
				border-radius: 300px 300px 0 0;
				position: relative;
				animation: move 1s linear infinite;
				transform-origin: bottom;
			}
			div{
				width: 150px;
				height: 150px;
				background-color: #fff;
				border-radius: 50%;
				position: absolute;
				top: 75px;
			}
			span{
				display: block;
				width: 50px;
				height: 50px;
				border-radius: 50%;
				background-color: black;
				margin:50px auto;
			}
			div:nth-of-type(2){
				left:150px;
				background-color: black;
			}
			div:nth-of-type(2)>span{
				background-color: #fff;
			}
			@keyframes move{
				from{
					transform: rotate(0deg);
				}
				to{
					transform: rotate(360deg);
				}
			}
		</style>

<body>
	<main>
		<div>
			<span></span>
		</div>
		<div>
			<span></span>
		</div>
	</main>
</body>

2.3D旋转图片

<style type="text/css">
			body{
				background-color: skyblue;
			}
			div{	
														/*设置整个div容器的宽高
															防止旋转圆心偏移
																* */
				width:300px;
				height: 200px;				
				position: relative;					/*把div进行定位在页面的中心*/
				margin: 100px auto;
				transform-style: preserve-3d;			/*设置子元素中存在3D效果*/
				animation: move 30s infinite linear;
				
			}
			img{
				width: 300px;								/*统一图片的大小*/
				height: 200px;
				position: absolute;							/*绝对定位 相当于把四张图片叠在 
                                                                     一起*/
			}
			img:nth-of-type(1){
				transform: rotateY(90deg) translateZ(200px);		/*先选择不同的度数,对            
                                                               应的Z轴发生变化*/
			}
			img:nth-of-type(2){
				transform: rotateY(180deg) translateZ(200px);
			}
			img:nth-of-type(3){
				transform: rotateY(270deg) translateZ(200px);
			}
			img:nth-of-type(4){
				transform: rotateY(360deg) translateZ(200px);
			}
		
			@keyframes move{
				from{transform: rotateY(0deg);}
				to{transform: rotateY(720deg);}
			}
	

		</style>
<body>
		<div>
			<img src="img/1.jpg" >
			<img src="img/2.jpg" >
			<img src="img/3.jpg" >
			<img src="img/4.jpg" >	
		</div>
	
	</body>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值