日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

3D景深探究

發布時間:2023/12/20 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 3D景深探究 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

參照CSS3景深、三維變換屬性及旋轉三維立方體的實現

.stage1 {width: 200px;height: 200px;border: 1px solid black;margin: 100px auto;perspective: 500px;/* perspective-origin: 10px 10px;//舞臺元素的中心位置 默認perspective-origin: 50% 50%; */}.stage1 .demo {width: 200px;height: 200px;background-color: orangered;transform: rotateX(45deg);}ul {/*調整ul標簽的樣式,取消內邊距、外邊距,和“點”樣式*/padding: 0;margin: 0;list-style-type: none;}.stage {/*設置舞臺元素在屏幕居中,設置合適的景深大小*/position: relative;width: 800px;height: 800px;margin: 100px auto;perspective: 800px;}@keyframes move {/*設置動畫關鍵幀*/0% {transform: rotateX(0deg);}25% {transform: rotateX(180deg);}50% {transform: rotateX(360deg) rotateY(0deg);}75% {transform: rotateX(360deg) rotateY(180deg);}100% {transform: rotateX(360deg) rotateY(360deg);}}.stage .three-d-box {/*動畫容器居中在舞臺元素中間*/width: 200px;height: 200px;position: absolute;left: 50%;top: 50%;margin: -100px 0 0 -100px;transform-style: preserve-3d;/*設置3D屬性讓子元素三維空間呈現*/animation: move 3s linear infinite;/*設置動畫*/}.stage .three-d-box>li {/*設置動畫子元素公共屬性*/position: absolute;width: 200px;height: 200px;left: 0;top: 0;font-size: 50px;line-height: 200px;text-align: center;opacity: 0.5;}/*為了保證我們對立方體位置的控制,我們需要讓動畫容器在立方體的中間位置*/.stage .three-d-box>li:nth-child(1) {background-color: red;transform: translateZ(-100px);}.stage .three-d-box>li:nth-child(2) {background-color: yellow;transform: translateZ(100px);}.stage .three-d-box>li:nth-child(3) {background-color: blue;transform: rotateX(90deg) translateZ(100px);}.stage .three-d-box>li:nth-child(4) {background-color: green;transform: rotateX(-90deg) translateZ(100px);}.stage .three-d-box>li:nth-child(5) {background-color: black;transform: rotateY(90deg) translateZ(100px);}.stage .three-d-box>li:nth-child(6) {background-color: purple;transform: rotateY(-90deg) translateZ(100px);} <div class="stage1"><div class="demo">1</div></div><!--舞臺元素,視角所在--><div class="stage"><!--動畫容器,通過它來控制整個立方體--><ul class="three-d-box"><li></li><!--動畫元素,立方體的六個面--><li></li><li></li><li></li><li></li><li></li></ul></div>

總結

以上是生活随笔為你收集整理的3D景深探究的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。