SOURCE

console 命令行工具 X clear

                    
>
console
let fontData, textAnimationData;
    let type = "flower";//transition 、effect 、text 、flower、animation
    let canvas = document.getElementById('canvas');
    let editor = new Editor(canvas);
    let wordArt, wordArt1;
    let fontNum = 0;
    let animation1, animation2, animation3, textType, stickerNode, textNode, sticker_url, text_url;
   
    let track_video = editor.track({ type: 'video', zIndex: 0 });
    let track_video1 = editor.track({ type: 'video', zIndex: 1 });
    let track_video2 = editor.track({ type: 'effect', zIndex: 2 });
    let videoNode = editor.video('https://tosv.byted.org/obj/eden-internal/uhyuhybd/video-editor-resource/assets/example2.mp4', {
      userData: {
        source: ''
      }
    });
    videoNode.timelineStart(1);
    videoNode.timelineStop(7);
    videoNode.name = 'video1';
    track_video1.addNode({ node: videoNode });

    let videoNode1 = editor.video('https://tosv.byted.org/obj/eden-internal/uhyuhybd/video-editor-resource/assets/cat_green_screen.mp4', {
      userData: {
        source: ''
      }
    });
    videoNode1.timelineStart(2);
    videoNode1.timelineStop(6);
    videoNode1.name = 'video1';
    track_video2.addNode({ node: videoNode1 });

    let imageNode1 = editor.image('//sf1-ttcdn-tos.pstatp.com/obj/ttfe/video_editor/16v9.jpg', {
      userData: {
        source: ''
      }
    });
    imageNode1.timelineStart(0);
    imageNode1.timelineStop(8);
    imageNode1.name = 'video1';
    track_video.addNode({ node: imageNode1 });


    
    initEvent();
    initEditor();
    function initEvent() {
      let addEffectDom = document.getElementById('addEffect');
      addEffectDom.onclick = () => {
        videoNode.addEffect({ effect,secondaryNode:[secondaryNode] });
      }
      let removeEffectDom = document.getElementById('removeEffect');
      removeEffectDom.onclick = () => {
        videoNode.removeEffect({ effect });
      }
    }
    function initEditor() {
      let graphCanvas = document.getElementById('graph');
      Editor.utils.visualiseVideoContextGraph(editor, graphCanvas,true);
      editor.on('timeupdate', () => {
        Editor.utils.visualiseVideoContextGraph(editor, graphCanvas);
      })
      InitVisualisations(editor, 'timeline-canvas', 'currentTime');
      playButton.onclick = () => {
        editor.play();
      }
      pauseButton.onclick = editor.pause.bind(editor);
      let interactiveBox = editor.initInteractiveBox(wrapper, {
        rotatable: true,
      });
    }
<div class="wrapper" id="wrapper">
    <canvas width="640" height="360" id="canvas"></canvas>
  </div>
  <button id="playButton">play</button>
  <button id="pauseButton">pause</button></br>
  <button id="addEffect">添加滤镜</button>
  <button id="removeEffect">删除滤镜</button>
  <p id="currentTime">
  </p>
  <p>
    <canvas id="timeline-canvas" width="640" height="20"></canvas>
  </p>
  <canvas width="640" height="360" id="graph"></canvas>
html {
    font-family: monospace;
    color: #333;
    /* background-color: black; */
  }
  #current {
    font-size: 12px;
  }
  #canvas {
    width: 640px;
    height: 360px;
  }
  #canvas2 {
    width: 640px;
    height: 360px;
    position: absolute;
    left: 0px;
    top: 0px;
    z-index: 10;
  }
  #container {
    position: relative;
  }

  button {
    line-height: 1.499;
      position: relative;
      display: inline-block;
      font-weight: 400;
      white-space: nowrap;
      text-align: center;
      background-image: none;
      border: 1px solid transparent;
      cursor: pointer;
      user-select: none;
      height: 32px;
      padding: 0 15px;
      font-size: 14px;
      border-radius: 4px;
      color: rgba(0,0,0,0.65);
      background-color: #fff;
      border-color: #d9d9d9;
      outline: 0;
      transition: all .3s cubic-bezier(.645, .045, .355, 1);
  }

  button:hover {
    color: #40a9ff;
    background-color: #fff;
    border-color: #40a9ff;
  }

  button:active {
    color: #096dd9;
    background-color: #fff;
    border-color: #096dd9;
  }

  input[type="text"] {
    -webkit-appearance: none;
    background-color: #fff;
    background-image: none;
    border-radius: 4px;
    border: 1px solid #dcdfe6;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    font-size: inherit;
    height: 32px;
    line-height: 32px;
    outline: none;
    padding: 0 8px;
    transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    width: 50px;
  }

  .wrapper {
    width: 640px;
    height: 360px;
    position: relative;
  }

@font-face {
  font-family: "hardFont";
  src: url('./../../assets/hardFont.ttf');
}
#bg-video{
    width:640px;
    height:400px;
}
#changeSrc{
    width:80%;
    height:40px;
    line-height: 40px;
}

本项目引用的自定义外部资源