mediabunny+vue实现支持ai生成的可视化拖拽时间轴带音频动画设计与编辑器可导出mp4视频代码
代码语言:html
所属分类:多媒体
代码描述:mediabunny+vue实现支持ai生成的可视化拖拽时间轴带音频动画设计与编辑器可导出mp4视频代码,可加载图片、svg、文字、音频内容可视化轨道拖拽移动,设置关键帧,改变元素的位置、大小、透明度,旋转等动画导出mp4视频,支持音频和音效插入。
代码标签: mediabunny vue 支持 ai 生成 可视化 拖拽 时间轴 音频 动画 设计 编辑器 导
下面为部分代码预览,完整代码请点击下载或在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>Vue 可视化时间轴关键帧动画设计器(修复属性不可改 + 本地导出MP4)</title> <style> :root{ --bg:#121319; --fg:#e8eaee; --muted:#a1a7b3; --panel:#181a22; --panel-2:#141622; --accent:#5a8cff; --danger:#ff5a62; --warn:#ffb74d; --key:#ffd166; --outline:#2f3444; --outline-2:#262a38; --pill:#24293a; } *{box-sizing:border-box;} html, body{height:100%;} body{ margin:0; background:var(--bg); color:var(--fg); font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji"; user-select:none; overflow:hidden; } button, input, select, textarea{ background:#222634; color:var(--fg); border:1px solid var(--outline); border-radius:8px; padding:8px 10px; font-size:13px; outline:none; } button{cursor:pointer; transition: all .15s ease;} button:hover{background:#2b3042;} button.primary{background:var(--accent); border-color:var(--accent);} button.ghost{background:transparent; border-color:var(--outline);} button.warning{background:var(--warn); border-color:var(--warn); color:#111;} button.danger{background:var(--danger); border-color:var(--danger);} input[type="color"]{padding:0; height:32px; width:40px; border-radius:6px;} input[type="range"]{width:160px;} input[type="number"]{height:32px;} select{height:32px;} textarea{resize:vertical; min-height:36px; max-height:120px; width:100%;} .container{ display:grid; grid-template-rows: auto 1fr auto; grid-template-columns: 1fr; height:100vh; } .toolbar{ display:flex; flex-wrap:wrap; gap:10px; padding:10px; background:linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--panel); border-bottom:1px solid var(--outline); position:sticky; top:0; z-index:20; backdrop-filter: blur(6px); } .group{ display:flex; align-items:center; gap:8px; padding:8px; border:1px solid var(--outline); background:var(--panel-2); border-radius:10px; } .group.stack{flex-direction:column; align-items:flex-start; gap:8px;} .subrow{display:flex; gap:8px; align-items:center; width:100%; flex-wrap:wrap;} details.group{ border:1px solid var(--outline); background:var(--panel-2); border-radius:10px; padding:6px 8px; } details.group[open]{background:linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--panel-2);} details.group > summary{ cursor:pointer; list-style:none; display:flex; align-items:center; gap:8px; padding:6px 8px; border-radius:8px; background:#1e2230; user-select:none; } details.group > summary::-webkit-details-marker{display:none;} details.group > summary::before{content:"▸"; color:#8fa3ff; margin-right:4px;} details.group[open] > summary::before{content:"▾";} details.group .subrow{margin-top:6px;} .tag{display:inline-flex; padding:4px 8px; background:#2a3042; color:#cdd4e3; border-radius:999px; font-size:12px;} .pill{border-radius:999px; padding:4px 10px; background:var(--pill); color:#c7d0e4; font-size:12px; border:1px solid var(--outline-2);} .muted{color:var(--muted);} .small{font-size:11px; color:#9aa3b4;} .main{ display:flex; gap:10px; padding:10px; overflow:hidden; align-items:stretch; background:linear-gradient(0deg, rgba(255,255,255,0.02), transparent); } .stage-wrap{ background:#0f1116; border:1px solid var(--outline); border-radius:12px; display:flex; flex-direction:column; overflow:hidden; min-width:420px; flex:1 1 auto; } .stage-toolbar{ display:flex; align-items:center; justify-content:space-between; padding:10px; border-bottom:1px solid var(--outline); background:#121626; position:sticky; top:0; z-index:5; } .stage{ flex:1; display:flex; align-items:center; justify-content:center; overflow:auto; padding:12px; } .stage-inner{ position:relative; background: conic-gradient(from 0deg, #0f1116 0deg 90deg, #11131d 90deg 180deg); background-size:24px 24px; border:1px solid #32374a; box-shadow:0 0 0 1px #000 inset, 0 10px 30px rgba(0,0,0,0.35); } .inspector{ flex:0 0 320px; min-width:280px; max-width:520px; resize:horizontal; overflow:auto; background:var(--panel-2); border:1px solid var(--outline); border-radius:12px; padding:8px; } .section{ padding:8px; border:1px solid var(--outline); border-radius:10px; margin-bottom:10px; background:rgba(255,255,255,0.01); } .section h3{ margin:0 0 8px 0; font-size:14px; color:#cbd0db; position:sticky; top:-8px; padding-top:8px; background:linear-gradient(180deg, rgba(24,26,34,0.98), rgba(24,26,34,0.6)); z-index:1; border-bottom:1px dashed var(--outline-2); padding-bottom:6px; } .row{display:flex; align-items:center; gap:8px; margin-bottom:8px; flex-wrap:wrap;} .row label{width:74px; color:var(--muted); font-size:12px;} .row input[type="number"]{width:100px;} .layer{position:absolute; outline:none; cursor:move; border-radius:4px;} .layer.selected{box-shadow:0 0 0 1px var(--accent) inset, 0 0 0 2px rgba(79,140,255,.25);} .handle{ position:absolute; width:12px; height:12px; background:var(--accent); border-radius:3px; border:1px solid #fff; box-shadow:0 0 0 1px rgba(0,0,0,0.4); } .handle.tl{left:-7px; top:-7px; cursor:nwse-resize;} .handle.tr{right:-7px; top:-7px; cursor:nesw-resize;} .handle.bl{left:-7px; bottom:-7px; cursor:nesw-resize;} .handle.br{right:-7px; bottom:-7px; cursor:nwse-resize;} .text-el{display:flex; align-items:center; justify-content:center; text-align:center; padding:4px; width:100%; height:100%;} .timeline{ background:#0f1017; border-top:1px solid var(--outline); padding:8px 10px; } .timeline-bar{ background:#0c0d13; border:1px solid var(--outline); border-radius:12px; overflow:auto; position:relative; height:230px; } .ruler{ position:sticky; top:0; background:#171a27; border-bottom:1px solid var(--outline); height:28px; display:flex; align-items:center; padding:0 8px; z-index:3; } .ruler .tick{position:absolute; top:0; bottom:0; width:1px; background:#2b3144;} .ruler .label{position:absolute; top:5px; font-size:11px; color:#96a0b5; transform:translateX(-50%);} .tracks{position:relative; min-width:100%; padding-top:8px;} .track{ display:grid; grid-template-columns: 180px 1fr; align-items:center; gap:8px; padding:6px 8px; border-bottom:1px dashed #252a3c; } .track .name{color:#cfd5e6; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;} .track .name .small{color:#8f97a9; font-size:11px;} .track .lane{ height:32px; background:linear-gradient(180deg, #14182a, #121628); border:1px solid #242a3b; border-radius:8px; position:relative; overflow:visible; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); } .kf{ position:absolute; top:50%; width:14px; height:14px; border-radius:50%; background:var(--key); border:1px solid #333; transform:translate(-50%, -50%); cursor:grab; box-shadow:0 2px 6px rgba(0,0,0,0.35); } .kf:hover{box-shadow:0 0 0 3px rgba(255,209,102,0.25);} .audio-clip{ position:absolute; top:4px; bottom:4px; background:linear-gradient(90deg, rgba(39,201,165,0.15), rgba(39,201,165,0.28)); border:1px solid rgba(39,201,165,0.6); color:#9debd9; font-size:11px; padding:2px 6px; border-radius:6px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; cursor:grab; } .scrubber{position:absolute; top:0; bottom:0; width:2px; background:#ff5a62; z-index:2;} .footer{ display:flex; justify-content:space-between; align-items:center; gap:12px; padding:8px 12px; border-top:1px solid var(--outline); background:var(--panel); font-size:12px; color:#9aa3b4; } .flex{display:flex; gap:8px; align-items:center;} .grow{flex:1;} ::-webkit-scrollbar{height:10px; width:10px;} ::-webkit-scrollbar-thumb{background:#2a2f42; border-radius:8px; border:2px solid #0c0d13;} ::-webkit-scrollbar-track{background:#0c0d13;} @media (max-width: 1100px){ .inspector{flex:0 0 300px;} input[type="range"]{width:120px;} } @media (max-width: 980px){ .main{flex-direction:column;} .stage-wrap{min-width:auto;} .inspector{flex:1 1 auto; min-width:auto; max-width:none; resize:none;} .row label{width:64px;} .toolbar .group{padding:6px;} .toolbar{gap:8px;} } </style> </head> <body> <div id="app" class="container"> <!-- 顶部工具栏 --> <div class="toolbar"> <div class="group"> <button class="ghost" @click="newProject">新建项目</button> <label class="ghost" style="padding:8px 10px; cursor:pointer;"> 导入JSON <input type="file" accept="application/json" style="display:none" @change="onImportJson"/> </label> <button @click="exportJson" class="primary">导出JSON</button> </div> <div class="group"> <label class="ghost" style="padding:8px 10px; cursor:pointer;"> 加载图片 <input type="file" accept="image/*" style="display:none" @change="onAddImage"/> </label> <label class="ghost" style="padding:8px 10px; cursor:pointer;"> 加载SVG <input type="file" accept=".svg,image/svg+xml" style="display:none" @change="onAddSvg"/> </label> <label class="ghost" style="padding:8px 10px; cursor:pointer;"> 加载音效 <input type="file" accept="audio/*" style="display:none" @change="onAddAudio"/> </label> <button class="ghost" @click="promptAddText">新增文字</button> </div> <div class="group&.........完整代码请登录后点击上方下载按钮下载查看
网友评论0