8.28学习笔记

1.  3d

transform:rotate(z)

perspective:规定3d元素的特殊效果,即焦距,透视的虚拟距离。属性值:number;  这个属性的3d效果给这个元素的父级

transform-style:preserve-3d 元素的子元素呈3d效果

backface-visibility:hidden/visible; 背面可见/背面不可见。

3d正方体实例:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
body{
perspective: 1000px;
}
@-webkit-keyframes zhuan{
from{transform: rotateY(0) rotateX(0);}
to{transform: rotateY(360deg) rotateX(360deg);}
}
.box{
width: 400px;
height: 400px;
/*border:1px solid yellow;*/
margin: 200px auto;
position: relative;
animation: zhuan 3s linear infinite;
transform-style: preserve-3d;

}
.box>div{
width: 400px;
height: 400px;
border: 1px solid brown;
position: absolute;
text-align: center;
line-height: 400px;
top: 0;
left: 0;

}
.box>div:nth-of-type(1){
background: darkred;
transform: translateZ(200px);
transition: all 2s linear;
}
.box>div:nth-of-type(2){
background: orangered;
transform: translateZ(-200px);
transition: all 2s linear;
}
.box>div:nth-of-type(3){
background: green;
transform:rotateX(90deg) translateZ(-200px);
transition: all 2s linear;
}
.box>div:nth-of-type(4){
background:yellow;
transform:rotateX(90deg) translateZ(200px);
transition: all 2s linear;
}
.box>div:nth-of-type(5){
background: blue;
transform:rotateY(90deg) translateZ(-200px);
transition: all 2s linear;
}
.box>div:nth-of-type(6){
background: pink;
transform:rotateY(90deg) translateZ(200px);
transition: all 2s linear;
}
.box:hover .a1{
transform: translateZ(400px);
}
.box:hover .a2{
transform: translateZ(-400px);
}
.box:hover .a3{
transform: translateZ(-400px) rotateX(90deg);
}
.box:hover .a4{
transform: translateZ(400px) rotateX(90deg);
}
.box:hover .a5{
transform: translateZ(-400px) rotateY(90deg);
}
.box:hover .a6{
transform: translateZ(400px) rotateY(90deg);
}
</style>
</head>
<body>
<div class="box">
<div class="a1">1</div>
<div class="a2">2</div>
<div class="a3">3</div>
<div class="a4">4</div>
<div class="a5">5</div>
<div class="a6">6</div>
</div>
</body>
</html>

转载于:https://www.cnblogs.com/xieyankeai/p/9547134.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值