three实现三维骰子与硬币 随机数生成器代码

代码语言:html

所属分类:三维

代码描述:three实现三维骰子与硬币 随机数生成器代码

代码标签: three 三维 骰子 硬币 随机数 生成器 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!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 {
            overflow: hidden;
            background: #1a1a2e;
            font-family: 'Microsoft YaHei', 'Segoe UI', sans-serif;
            user-select: none;
        }
        canvas { display: block; }

        #ui {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 10;
        }

        .panel {
            position: absolute;
            background: rgba(10, 10, 30, 0.85);
            border: 1px solid rgba(255, 215, 0, 0.3);
            border-radius: 16px;
            padding: 20px;
            backdrop-filter: blur(10px);
            box-shadow: 0 8px 32px rgba(0,0,0,0.5);
        }

        .top-panel {
            top: 15px;
            left: 50%;
            transform: translateX(-50%);
            text-align: center;
            min-width: 300px;
        }

        .top-panel h1 {
            color: #ffd700;
            font-size: 22px;
            margin-bottom: 5px;
            text-shadow: 0 0 15px rgba(255,215,0,0.5);
            letter-spacing: 3px;
        }

        .top-panel p {
            color: rgba(255,255,255,0.5);
            font-size: 12px;
        }

        .controls {
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 15px;
            align-items: center;
            pointer-events: auto;
        }

        .btn {
            padding: 14px 32px;
            border: none;
            border-radius: 12px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s ease;
            font-family: inherit;
            letter-spacing: 1px;
            position: relative;
            overflow: hidden;
        }

        .btn::after {
            content: '';
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 60%);
            opacity: 0;
            transition: opacity 0.3s;
        }

        .btn:hover::after { opacity: 1; }

        .btn-dice {
            background: linear-gradient(135deg, #e74c3c, #c0392b);
            color: white;
            box-shadow: 0 4px 20px rgba(231,76,60,0.4);
        }
        .btn-dice:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 25px rgba(231,76,60,0.6);
        }
        .btn-dice:active { transform: translateY(0); }

        .btn-coin {
            background: linear-gradient(135deg, #f39c12, #d68910);
            color: white;
            box-shadow: 0 4px 20px rgba(243,156,18,0.4);
        }
        .btn-coin:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 25px rgba(243,156,18,0.6);
        }
        .btn-coin:active { transform: translateY(0); }

        .btn-both {
            background: linear-gradient(135deg, #9b59b6, #8e44ad);
            color: white;
            box-shadow: 0 4px 20px rgba(155,89,182,0.4);
        }
        .btn-both:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 25px rgba(155,89,182,0.6);
        }

        .btn-reset {
            background: linear-gradient(135deg, #555, #333);
            color: #ccc;
            box-shadow: 0 4px 15px rgba(0,0,0,0.3);
            padding: 14px 20px;
        }
        .btn-reset:hover {
            transform: translateY(-2px);
            color: white;
        }

        .result-panel {
            top: 50%;
            right: 25px;
            transform: translateY(-50%);
            min-width: 200px;
        }

        .result-panel h3 {
            color: #ffd700;
            font-size: 16px;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid rgba(255,215,0,0.2);
 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0