vue+gsap实现3d翻转文字幻灯片效果代码

代码语言:html

所属分类:幻灯片

代码描述:vue+gsap实现3d翻转文字幻灯片效果代码

代码标签: vue gsap 3d 翻转 文字 幻灯片

下面为部分代码预览,完整代码请点击下载或在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>Vue2 + GSAP 翻页式过渡</title>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/vue@2.6.1-dev.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.13.0.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: 'Poppins', sans-serif;
            background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #333;
            overflow-x: hidden;
        }
        
        #app {
            width: 100%;
            max-width: 1200px;
            padding: 20px;
        }
        
        header {
            text-align: center;
            margin-bottom: 40px;
            padding: 20px;
        }
        
        h1 {
            font-size: 2.8rem;
            color: white;
            text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
            margin-bottom: 10px;
        }
        
        .subtitle {
            color: rgba(255, 255, 255, 0.85);
            font-size: 1.2rem;
            max-width: 600px;
            margin: 0 auto;
        }
        
        .page-container {
            position: relative;
            width: 100%;
            max-width: 900px;
            height: 550px;
            margin: 0 auto;
            perspective: 2000px; /* 3D效果的关键 */
        }
        
        /* 修改:这是我们将要动画的容器 */
        .page-wrapper {
            position: absolute;
            width: 100%;
            height: 100%;
            top: 0;
            left: 0;
            backface-visibility: hidden; /* 翻转到背面时隐藏 */
            transform-style: preserve-3d;
            border-radius: 12px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
            overflow: hidden;
            background: white;
        }
        
        .page {
            width: 100%;
            height: 100%;
            padding: 40px;
            position: relative;
            overflow-y: auto;
        }
        
        .page-content {
            max-width: 700px;
            margin: 0 auto;
        }
        
        .page h2 {
            font-size: 2.2rem;
            margin-bottom: 25px;
            color: #2c3e50;
            position: relative;
            padding-bottom: 15px;
        }
        
        .page h2::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 70px;
            height: 4px;
            background: linear-gradient(90deg, #6a11cb, #2575fc);
            border-radius: 2px;
        }
        
        .page p {
            font-size: 1.1rem;
            line-height: 1.8;
            margin.........完整代码请登录后点击上方下载按钮下载查看

网友评论0