」工欲善其事,必先利其器。「—孔子《論語.錄靈公》
首頁 > 程式設計 > 使用 html css 和 javascript 的圖像輪播旋轉幻覺

使用 html css 和 javascript 的圖像輪播旋轉幻覺

發佈於2024-11-08
瀏覽:936

Image carousel rotation illusion using html css and javascript

程式碼





旋轉影像輪播

    身體 {
        顯示:柔性;
        調整內容:居中;
        對齊項目:居中;
        高度:100vh;
        保證金:0;
        背景顏色:#0d0d0d;
        溢出:隱藏;
        過渡:背景影像 0.5 秒緩和;
        背景大小:封面;
        背景位置:中心;

    }

    /* 輪播容器 */
    .輪播{
        位置:相對;
        寬度:130px;
        高度:130像素;
        變換風格:保留 3d;
        視角:1000px;
        過渡:變換1s;
    }

    /* 圖像樣式 */
    .carousel img {
        位置:絕對;
        高度:100%;
        寬度:100%;
        /* 寬度: 150px;
        高度:150px; */
        邊框半徑:10px;
        盒子陰影: 0 0 10px rgba(255, 110, 199, 0.3);
        變換原點:中心;
        過渡:變換0.5s,過濾0.5s;
        不透明度:0.8;
    }

    /* 圍繞 Y 軸定位每個影像 */
    .carousel img:nth-​​child(1){ 變換:rotateY(0deg)translateZ(150px); }
    .carousel img:nth-​​child(2){ 變換:rotateY(72deg)translateZ(150px); }
    .carousel img:nth-​​child(3){ 變換:rotateY(144deg)translateZ(150px); }
    .carousel img:nth-​​child(4){ 變換:rotateY(216deg)translateZ(150px); }
    .carousel img:nth-​​child(5){ 變換:rotateY(288deg)translateZ(150px); }

    /* 控制圖示 */
    .controls {
        位置:絕對;
        底部:20px;
        左:20 像素;
        顯示:柔性;
        間隙:10px;
    }
    .controls按鈕{
        寬度:40px;
        高度:40px;
        字體大小:18px;
        邊框:無;
        背景顏色:#181616;
        顏色:#fff;
        遊標:指針;
        邊界半徑:50%;
        過渡:背景色0.3s;
    }
    .controls按鈕:懸停{
        背景顏色:#555;
    }
風格>
頭>


版本聲明 本文轉載於:https://dev.to/prince_beec5ccde00b7c6c73/3d-image-carousel-rotation-illusion-using-html-css-and-javascript-1c0l?1如有侵犯,請聯繫[email protected]刪除
最新教學 更多>

免責聲明: 提供的所有資源部分來自互聯網,如果有侵犯您的版權或其他權益,請說明詳細緣由並提供版權或權益證明然後發到郵箱:[email protected] 我們會在第一時間內為您處理。

Copyright© 2022 湘ICP备2022001581号-3