3D玫瑰花 - HTML5

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3D玫瑰花 - HTML5</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            background: #000;
            overflow: hidden;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            font-family: Arial, sans-serif;
        }
        
        .container {
            position: relative;
            width: 100%;
            height: 100%;
        }
        
        .rose {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 200px;
            height: 200px;
        }
        
        .petal {
            position: absolute;
            width: 20px;
            height: 30px;
            background: linear-gradient(to bottom, #ff3385, #ff0066);
            border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
            box-shadow: 0 0 10px rgba(255, 0, 102, 0.5);
            transform-origin: bottom center;
            animation: bloom 5s infinite alternate;
        }
        
        .stem {
            position: absolute;
            width: 8px;
            height: 300px;
            background: linear-gradient(to bottom, #009900, #006600);
            top: 100px;
            left: 96px;
            transform: rotate(180deg);
            z-index: -1;
        }
        
        .leaf {
            position: absolute;
            width: 40px;
            height: 20px;
            background: #009900;
            border-radius: 50% 50% 0 50%;
            transform: rotate(45deg);
            top: 200px;
            left: 90px;
            z-index: -1;
        }
        
        @keyframes bloom {
            0% {
                transform: rotate(0deg) translateY(0) scale(0.8);
                opacity: 0.7;
            }
            100% {
                transform: rotate(360deg) translateY(-50px) scale(1.2);
                opacity: 1;
            }
        }
        
        .info {
            position: absolute;
            bottom: 20px;
            color: white;
            text-align: center;
            width: 100%;
        }
        
        a {
            color: #ff0066;
            text-decoration: none;
        }
        
        a:hover {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="rose" id="rose"></div>
        <div class="stem"></div>
        <div class="leaf"></div>
        
        <div class="info">

        </div>
    </div>

    <script>
        const rose = document.getElementById('rose');
        const petalCount = 50;
        
        for (let i = 0; i < petalCount; i++) {
            const petal = document.createElement('div');
            petal.className = 'petal';
            
            // Position petals in a spiral
            const angle = (i / petalCount) * Math.PI * 2;
            const distance = 50 + (i % 10) * 5;
            const x = Math.cos(angle) * distance;
            const y = Math.sin(angle) * distance;
            
            petal.style.left = `${100 + x}px`;
            petal.style.top = `${100 + y}px`;
            petal.style.transform = `rotate(${angle}rad) translateY(-${distance}px)`;
            petal.style.animationDelay = `${i * 0.1}s`;
            
            // Vary petal size
            const size = 0.5 + Math.random() * 0.5;
            petal.style.width = `${20 * size}px`;
            petal.style.height = `${30 * size}px`;
            
            // Vary petal color slightly
            const hue = 330 + Math.random() * 20;
            petal.style.background = `linear-gradient(to bottom, hsl(${hue}, 100%, 60%), hsl(${hue}, 100%, 50%)`;
            
            rose.appendChild(petal);
        }
    </script>
</body>
</html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值