js+css实现图片色盘故事卡片生成器代码

代码语言:html

所属分类:其他

代码由deepseek-v4-pro ai生成,可能有错误,仅供参考:点击查看提示词

代码描述:图片色盘故事卡片生成器

代码标签: js css 图片 色盘 故事 卡片 生成器 代码

下面为部分代码预览,完整代码请点击下载或在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>色盘记忆卡片 - 从照片中提取色彩与故事</title>
    <script src="https://cdn.jsdelivr.net/npm/html2canvas@1.4.1/dist/html2canvas.min.js">
    </script>
    <style>
        :root {
            --bg: #f5f0eb;
            --card-bg: #fdfaf6;
            --text: #3a3335;
            --text-secondary: #6b5e62;
            --accent: #c4a882;
            --border: #e5ddd4;
            --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
            --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.10);
            --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
            --radius-sm: 10px;
            --radius: 16px;
            --radius-lg: 20px;
            --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            --font-serif: 'Georgia', 'Noto Serif SC', 'STSong', 'Songti SC', 'SimSun', serif;
            --font-sans: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            background: var(--bg);
            background-image:
                radial-gradient(ellipse at 20% 10%, rgba(210, 190, 160, 0.25) 0%, transparent 60%),
                radial-gradient(ellipse at 80% 90%, rgba(180, 200, 210, 0.2) 0%, transparent 60%),
                radial-gradient(ellipse at 50% 50%, rgba(220, 210, 195, 0.15) 0%, transparent 70%);
            min-height: 100vh;
            font-family: var(--font-sans);
            color: var(--text);
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            letter-spacing: 0.02em;
            padding: 20px 16px 60px;
        }

        /* 头部 */
        .header {
            text-align: center;
            padding: 30px 20px 20px;
            position: relative;
        }
        .header-icon {
            font-size: 48px;
            display: block;
            margin-bottom: 6px;
            animation: float 3s ease-in-out infinite;
        }
        @keyframes float {
            0%,
            100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-10px);
            }
        }
        .header h1 {
            font-family: var(--font-serif);
            font-size: 2rem;
            font-weight: 400;
            letter-spacing: 0.04em;
            color: #3a3335;
            margin-bottom: 6px;
            line-height: 1.3;
        }
        .header .subtitle {
            font-size: 0.9rem;
            color: var(--text-secondary);
            letter-spacing: 0.06em;
            font-weight: 300;
        }
        .header .accent-line {
            display: block;
            width: 50px;
            height: 2px;
            background: var(--accent);
            margin: 12px auto 0;
            border-radius: 1px;
            opacity: 0.7;
        }

        /* 上传区域 */
        .upload-section {
            max-width: 700px;
            margin: 0 auto 30px;
        }
        .upload-zone {
            background: var(--card-bg);
            border: 2px dashed var(--border);
            border-radius: var(--radius-lg);
            padding: 40px 30px;
            text-align: center;
            cursor: pointer;
            transition: all var(--transition);
            position: relative;
            overflow: hidden;
            box-shadow: var(--shadow-sm);
        }
        .upload-zone:hover {
            border-color: var(--accent);
            box-shadow: var(--shadow-md);
            transform: translateY(-2px);
            background: #fffdf9;
        }
        .upload-zone.drag-over {
            border-color: #b8956e;
            background: #fef9f3;
            box-shadow: 0 0 0 8px rgba(196, 168, 130, 0.1);
            transform: scale(1.01);
        }
        .upload-zone .upload-icon {
            font-size: 56px;
            display: block;
            margin-bottom: 12px;
            transition: transform var(--transition);
        }
        .upload-zone:hover .upload-icon {
            transform: scale(1.08);
        }
        .upload-zone .upload-text {
            font-size: 1.05rem;
            color: #4a4447;
            letter-spacing: 0.03em;
            margin-bottom: 4px;
        }
        .upload-zone .upload-hint {
            font-size: 0.8rem;
            color: #9a8f85;
            letter-spacing: 0.04em;
        }
        #fileInput {
            display: none;
        }

        /* 缩略图预览条 */
        .thumb-strip {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            margin-top: 16px;
            justify-content: center;
            min-height: 20px;
        }
        .thumb-strip .mini-thumb {
            width: 56px;
            height: 56px;
            border-radius: 10px;
            object-fit: cover;
            border: 2px solid #fff;
            box-shadow: var(--shadow-sm);
            transition: all var(--transition);
            cursor: pointer;
            animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
        }
        .thumb-strip .mini-thumb:hover {
            transform: scale(1.12);
            box-shadow: var(--shadow-md);
            border-color: var(--accent);
        }
        @keyframes popIn {
            0% {
                opacity: 0;
                transform: scale(0.6);
            }
            100% {
                opacity: 1;
                transform: scale(1);
            }
        }
        .thumb-strip .thumb-count {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 56px;
            height: 56px;
            border-radius: 10px;
            background: var(--card-bg);
            border: 2px solid var(--border);
            font-size: 0.85rem;
            color: var(--text-secondary);
            letter-spacing: 0.04em;
      .........完整代码请登录后点击上方下载按钮下载查看

网友评论0