3D垂直滚动轮播效果

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D垂直滚动轮播效果</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: Arial, sans-serif;
            background: #f5f5f5;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            perspective: 1000px;
        }
        
        .carousel-container {
            width: 300px;
            height: 400px;
            position: relative;
            transform-style: preserve-3d;
            animation: rotate 15s infinite linear;
        }
        
        .carousel-item {
            position: absolute;
            width: 100%;
            height: 100%;
            background: white;
            border-radius: 10px;
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 24px;
            font-weight: bold;
            color: white;
            transition: transform 0.5s ease;
            backface-visibility: hidden;
        }
        
        .carousel-item:nth-child(1) {
            background: linear-gradient(45deg, #ff9a9e, #fad0c4);
            transform: rotateY(0deg) translateZ(400px);
        }
        
        .carousel-item:nth-child(2) {
            background: linear-gradient(45deg, #a1c4fd, #c2e9fb);
            transform: rotateY(60deg) translateZ(400px);
        }
        
        .carousel-item:nth-child(3) {
            background: linear-gradient(45deg, #ffecd2, #fcb69f);
            transform: rotateY(120deg) translateZ(400px);
        }
        
        .carousel-item:nth-child(4) {
            background: linear-gradient(45deg, #84fab0, #8fd3f4);
            transform: rotateY(180deg) translateZ(400px);
        }
        
        .carousel-item:nth-child(5) {
            background: linear-gradient(45deg, #a6c1ee, #fbc2eb);
            transform: rotateY(240deg) translateZ(400px);
        }
        
        .carousel-item:nth-child(6) {
            background: linear-gradient(45deg, #d4fc79, #96e6a1);
            transform: rotateY(300deg) translateZ(400px);
        }
        
        @keyframes rotate {
            from {
                transform: rotateY(0deg);
            }
            to {
                transform: rotateY(360deg);
            }
        }
        
        .download-btn {
            position: absolute;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            padding: 10px 20px;
            background: #4CAF50;
            color: white;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 16px;
            text-decoration: none;
        }
        
        .download-btn:hover {
            background: #45a049;
        }
        
        .credit {
            position: absolute;
            bottom: 70px;
            left: 50%;
            transform: translateX(-50%);
            color: #666;
            font-size: 12px;
        }
    </style>
</head>
<body>
    <div class="carousel-container">
        <div class="carousel-item">项目 1</div>
        <div class="carousel-item">项目 2</div>
        <div class="carousel-item">项目 3</div>
        <div class="carousel-item">项目 4</div>
        <div class="carousel-item">项目 5</div>
        <div class="carousel-item">项目 6</div>
    </div>
    
    <a href="#" class="download-btn" id="downloadBtn">下载代码</a>
    
    <script>
        document.getElementById('downloadBtn').addEventListener('click', function() {
            // 创建Blob对象
            const content = document.documentElement.outerHTML;
            const blob = new Blob([content], {type: 'text/html'});
            
            // 创建下载链接
            const url = URL.createObjectURL(blob);
            const a = document.createElement('a');
            a.href = url;
            a.download = '3d-carousel.html';
            
            // 触发下载
            document.body.appendChild(a);
            a.click();
            
            // 清理
            setTimeout(() => {
                document.body.removeChild(a);
                URL.revokeObjectURL(url);
            }, 100);
        });
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值