Browse Source

add dummy transition

new-features-2020
Mikael Finstad 6 years ago
parent
commit
7353159382
  1. 2
      README.md
  2. 6
      examples/audio-transition.json5
  3. 9
      index.js

2
README.md

@ -181,7 +181,7 @@ Edit specs are JavaScript / JSON objects describing the whole edit operation wit
### Transition types
`transition.name` can be any of [gl-transitions](https://gl-transitions.com/gallery), or any of the following: `directional-left`, `directional-right`, `directional-up`, `directional-down` and `random`.
`transition.name` can be any of [gl-transitions](https://gl-transitions.com/gallery), or any of the following: `directional-left`, `directional-right`, `directional-up`, `directional-down`, `random` or `dummy`.
### Layer types

6
examples/audio-transition.json5

@ -23,9 +23,13 @@
{ type: 'title-background', text: 'Clip 4' },
{ type: 'audio', path: './assets/sample2.m4a' }
] },
{ layers: [
{ transition: { name: 'dummy' }, layers: [
{ type: 'title-background', text: 'Clip 5' },
{ type: 'audio', path: './assets/sample1.m4a' }
] },
{ layers: [
{ type: 'title-background', text: 'Clip 6' },
{ type: 'audio', path: './assets/sample2.m4a' }
] },
],
}

9
index.js

@ -152,7 +152,14 @@ const Editly = async (config = {}) => {
return newAcc;
}, 0);
const { runTransitionOnFrame } = GlTransitions({ width, height, channels });
const { runTransitionOnFrame: runGlTransitionOnFrame } = GlTransitions({ width, height, channels });
function runTransitionOnFrame({ fromFrame, toFrame, progress, transitionName, transitionParams }) {
// A dummy transition can be used to have an audio transition without a video transition
// (Note: You will lose a portion from both clips due to overlap)
if (transitionName === 'dummy') return progress > 0.5 ? toFrame : fromFrame;
return runGlTransitionOnFrame({ fromFrame, toFrame, progress, transitionName, transitionParams });
}
function startFfmpegWriterProcess() {
// https://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality

Loading…
Cancel
Save