js+css实现json配置带解说声音及字幕的儿童图片故事绘本幻灯片代码

代码语言:html

所属分类:幻灯片

代码描述:js+css实现json配置带解说声音及字幕的儿童图片故事绘本幻灯片代码,每张图片有随机的缩放动画,可以通过getDisplayMedia录屏来录制视频及声音发布到抖音上,json中配置图片地址、声音地址及字幕旁白文字信息。

代码标签: js css json 配置 解说 声音 字幕 儿童 图片 故事 绘本 幻灯 片代码

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

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <title>抖音故事模板 - 录制与Ken Burns (Tab Capture Focus)</title>
    <style>
        body, html {
            margin: 0;
            padding: 0;
            height: 100%;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #111;
            display: flex;
            flex-direction: column; /* Allow controls below player */
            justify-content: center;
            align-items: center;
            overflow: hidden;
        }

        .story-player-douyin {
            width: 360px;
            height: 640px;
            background-color: #000;
            border-radius: 10px;
            box-shadow: 0 0 20px rgba(255,255,255,0.1);
            display: flex;
            flex-direction: column;
            overflow: hidden;
            position: relative;
            /* border: 2px solid #333; /* Optional: to visually see the player bounds */
        }

        .image-viewport {
            flex-grow: 1;
            position: relative;
            overflow: hidden;
            background-color: #222;
        }

        .page {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
        }

        .page img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            position: absolute;
            top:0; left:0;
            transform: scale(1.1);
            animation-timing-function: ease-in-out;
            animation-iteration-count: 1;
            animation-fill-mode: forwards;
        }

        @keyframes kenburns-zoom-in-bottom-right {
            0% { transform: scale(1.1) translate(0, 0); transform-origin: center center; }
            100% { transform: scale(1.3) translate(-5%, -5%); transform-origin: center center; }
        }
        @keyframes kenburns-zoom-out-top-left {
            0% { transform: scale(1.3) translate(-5%, -5%); transform-origin: center center; }
            100% { transform: scale(1.1) translate(0, 0); transform-origin: center center; }
        }
        @keyframes kenburns-zoom-in-from-top-left {
            0% { transform: scale(1.1) translate(0,0); transform-origin: top left; }
            100% { transform: scale(1.25) translate(0,0); transform-origin: top left; }
        }
        @keyframes kenburns-zoom-out-to-bottom-right {
            0% { transform: scale(1.25) translate(0,0); transform-origin: bottom right; }
            100% { transform: scale(1.1) translate(0,0); transform-origin: bottom right; }
        }
        @keyframes kenburns-pan-left-to-right {
            0% { transform: scale(1.15) translateX(-5%); }
            100% { transform: scale(1.15) translateX(5%); }
        }
        @keyframes kenburns-static-zoom {
            0% { transform: scale(1.1); }
            100% { transform: scale(1.12); }
        }

        .animate-zoom-in-br { animation-name: kenburns-zoom-in-bottom-right; }
        .animate-zoom-out-tl { animation-name: kenburns-zoom-out-top-left; }
        .animate-zoom-in-tl { animation-name: kenburns-zoom-in-from-top-left; }
        .animate-zoom-out-br { animation-name: kenburns-zoom-out-to-bottom-right; }
        .animate-pan-lr { animation-name: kenburns-pan-left-to-right; }
        .animate-static-zoom { animation-name: kenburns-static-zoom; }

        .narration-box {
            position: absolute;
            bottom: 15%;
            left: 5%;
            right: 5%;
            background-color: rgba(0, 0, 0, 0.65);
            color: #fff;
            padding: 12px 15px;
            border-radius: 8px;
            font-size: 16px;
            line-height: 1.5;
            text-align: center;
            max-height: 30%;
            overflow-y: auto;
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 0.5s ease-out 0.3s, transform 0.5s ease-out 0.3s;
            z-index: 5;
        }
        .narration-box.visible { opacity: 1; transform: translateY(0); }

        .progress-bar-container {
            position: absolute;
            bottom: 50px;
            left: 5%;
            right: 5%;
            height: 6px;
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
            z-index: 5;
        }
        #progress-bar {
            width: 0%;
            height: 100%;
            background-color: #fff;
            border-radius: 3px;
            transition: width 0.3s linear;
        }

        .end-screen {
            position: absolute; top: 0; left: 0; width: 100%; height: 100%;
            background-color: rgba(0,0,0,0.85); color: white;
      .........完整代码请登录后点击上方下载按钮下载查看

网友评论0