JS+CSS實(shí)現(xiàn)炫酷光感效果
JS+CSS帶你實(shí)現(xiàn)炫酷光感效果,供大家參考,具體內(nèi)容如下
效果一:(螺旋式沉浸視覺感受)

效果二:(旋渦式遠(yuǎn)觀視覺感受)

實(shí)現(xiàn)代碼:
<!DOCTYPE html><html> <head> <meta charset='utf-8'> <title>光感效果</title> </head> <style> html,body{ height: 100%; overflow: hidden; } body{ background-color: #c08eaf; } .main{ /* 中心點(diǎn) */ width: 8px; height: 8px; /* background-color: aqua; */ position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); /* *景深,修改此屬性可獲得如上圖展示的不同效果 *如:圖一的perspective為400px *圖二的perspective為800px *修改為其它值還可獲得更多效果 */ perspective: 800px; } .main i{ /* 動(dòng)點(diǎn) */ width: 8px; height: 8px; border-radius: 50%; background:white; box-shadow: 0 0 10px 0 white; position: absolute; /* 動(dòng)畫 */ animation: run 3s ease-in-out infinite; } /* .main i:nth-child(1){ transform: rotate(0deg) translateX(80px); } */ /* 動(dòng)畫 */ @keyframes run{ 0%{ opacity: 0; } 10%{ opacity: 1; } 100%{ opacity: 1; /* 3D動(dòng)畫效果 */ transform: translate3d(0,0,560px); } } </style> <body> <div id='main'> </div> </body> <script type='text/javascript'> //獲取元素 var m = document.getElementById('main'); for(var i = 0;i<60;i++){ //創(chuàng)建元素 var newNode = document.createElement('i'); //添加元素 m.appendChild(newNode) //設(shè)置旋轉(zhuǎn)角度 及x軸方向位移距離 newNode.style.transform=`rotate(${i*12}deg) translateX(80px)` //設(shè)置動(dòng)畫延遲 newNode.style.animationDelay=`${i*0.05}s` } </script></html>
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。
相關(guān)文章:
1. PHP使用Swagger生成好看的API文檔2. Python 如何調(diào)試程序崩潰錯(cuò)誤3. Python3 json模塊之編碼解碼方法講解4. Python 利用Entrez庫篩選下載PubMed文獻(xiàn)摘要的示例5. ASP.NET MVC使用jQuery ui的progressbar實(shí)現(xiàn)進(jìn)度條6. ASP基礎(chǔ)知識(shí)VBScript基本元素講解7. Python 制作查詢商品歷史價(jià)格的小工具8. python使用jenkins發(fā)送企業(yè)微信通知的實(shí)現(xiàn)9. Python sublime安裝及配置過程詳解10. Python 合并拼接字符串的方法

網(wǎng)公網(wǎng)安備