vue+mediabunny实现ai可视化拖拽时间轴动画生成与编辑导出mp4视频代码

代码语言:html

所属分类:动画

代码描述:vue+mediabunny实现ai可视化拖拽时间轴动画生成与编辑导出mp4视频代码,可通过将图片、svg、文字、声音文件加入时间轴轨道,设置关键帧,移动、缩放、旋转,透明度等属性设置来形成动画效果,可加入音效,最后可导出时间轴的json文件,也可以加载json文件,最后导出webm或mp4视频,完全浏览器操作,完整的可视化动画拖拽设计web应用,基于vue。

代码标签: vue mediabunny ai 可视化 拖拽 时间轴 动画 生成 编辑 导出 mp4 视频 代码

下面为部分代码预览,完整代码请点击下载或在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 可视化时间轴关键帧动画设计器(AI + 本地导出MP4,修复fit报错/花屏/无声)</title>
<style>
  :root{
    --bg:#17181c;
    --fg:#e8e8ea;
    --muted:#a0a4ad;
    --panel:#1f2127;
    --accent:#4f8cff;
    --accent-2:#27c9a5;
    --danger:#ff5a62;
    --warn:#ffb74d;
    --key:#ffd166;
  }
  *{box-sizing:border-box;}
  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:#2a2d36;
    color:var(--fg);
    border:1px solid #333844;
    border-radius:6px;
    padding:6px 10px;
    font-size:13px;
    outline:none;
  }
  textarea{resize:vertical; min-height:32px; max-height:120px;}
  button:hover{background:#323645;}
  button.primary{background:var(--accent); border-color:var(--accent);}
  button.ghost{background:transparent; border-color:#3a3f4e;}
  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:28px; width:36px;}
  input[type="range"]{width:100%;}
  .toolbar{
    display:flex; align-items:flex-start; gap:8px; flex-wrap:wrap;
    padding:10px; background:var(--panel); border-bottom:1px solid #313645;
  }
  .toolbar .group{
    display:flex; align-items:center; gap:6px;
    padding-right:10px; border-right:1px solid #313645; margin-right:10px;
  }
  .toolbar .group.stack{flex-direction:column; align-items:flex-start; gap:6px;}
  .subrow{display:flex; gap:6px; align-items:center; width:100%;}
  .container{
    display:grid;
    grid-template-rows: auto 1fr auto;
    grid-template-columns: 1fr;
    height:100vh;
  }
  .main{
    display:grid;
    grid-template-columns: 1fr 300px;
    gap:8px;
    padding:8px;
    overflow:hidden;
  }
  .stage-wrap{
    background:#0f1116; border:1px solid #2b2f3d; border-radius:8px;
    display:flex; flex-direction:column; overflow:hidden; min-width:400px;
  }
  .stage-toolbar{
    display:flex; align-items:center; justify-content:space-between;
    padding:8px; border-bottom:1px solid #313645;
  }
  .stage{
    flex:1; display:flex; align-items:center; justify-content:center; overflow:auto; padding:12px;
  }
  .stage-inner{
    position:relative;
    background: repeating-conic-gradient(from 0deg, #0f1116 0deg 90deg, #121420 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);
  }
  .layer{
    position:absolute;
    outline: none;
    cursor:move;
  }
  .layer.selected{box-shadow:0 0 0 1px var(--accent) inset;}
  .handle{
    position:absolute; width:10px; height:10px; background:var(--accent); border-radius:50%;
    border:1px solid #fff; box-shadow:0 0 0 1px rgba(0,0,0,0.4);
  }
  .handle.tl{left:-6px; top:-6px; cursor:nwse-resize;}
  .handle.tr{right:-6px; top:-6px; cursor:nesw-resize;}
  .handle.bl{left:-6px; bottom:-6px; cursor:nesw-resize;}
  .handle.br{right:-6px; bottom:-6px; cursor:nwse-resize;}
  .text-el{display:flex; align-items:center; justify-content:center; text-align:center; padding:4px; width:100%; height:100%;}
  .inspector{
    background:var(--panel); border:1px solid #2b2f3d; border-radius:8px; overflow:auto;
    padding:8px;
  }
  .section{padding:8px; border-bottom:1px solid #313645;}
  .section h3{margin:0 0 6px 0; font-size:14px; color:#cbd0db;}
  .row{display:flex; align-items:center; gap:8px; margin-bottom:6px;}
  .row label{width:80px; color:var(--muted); font-size:12px;}
  .row input[type="number"]{width:90px;}
  .tag{display:inline-flex; padding:2px 6px; background:#394155; color:#cdd4e3; border-radius:999px; font-size:12px;}
  .timeline{
    background:#101118; border-top:1px solid #2b2f3d; padding:6px 8px;
  }
  .timeline-bar{
    background:#0c0d13; border:1px solid #2b2f3d; border-radius:8px;
    overflow:auto; position:relative; height:220px;
  }
  .ruler{
    position:sticky; top:0; background:#1a1c24; border-bottom:1px solid #2b2f3d;
    height:26px; display:flex; align-items:center; gap:12px; padding:0 8px; z-index:3;
  }
  .ruler .tick{position:absolute; top:0; bottom:0; width:1px; background:#2b2f3d;}
  .ruler .label{position:absolute; top:4px; 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 #252838;
  }
  .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:28px; background:#141622; border:1px solid #22253a; border-radius:6px; position:relative; overflow:visible;
  }
  .kf{
    position:absolute; top:50%; width:12px; height:12px; 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 2px rgba(255,209,102,0.35);}
  .scrubber{
    position:absolute; top:0; bottom:0; width:2px; background:#ff5a62; z-index:2;
  }
  .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:4px;
    overflow:hidden; white-space:nowrap; text-overflow:ellipsis; cursor:grab;
  }
  .legend{color:#93a0b8; font-size:12px;}
  .footer{
    display:flex; justify-content:space-bet.........完整代码请登录后点击上方下载按钮下载查看

网友评论0