Skip to content

Commit

Permalink
Allow overriding transition parameters (fixes transitive-bullshit#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Kováč committed Jun 20, 2018
1 parent c5887d2 commit 972570a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/render-frames.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ module.exports.renderFrame = async (opts) => {
await ctx.render({
imagePathFrom: cFramePath,
imagePathTo: nFramePath,
progress: cProgress
progress: cProgress,
params: current.transition.params
})

await ctx.capture(filePath)
Expand Down
5 changes: 3 additions & 2 deletions lib/transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ module.exports = (opts) => {
draw: async ({
imagePathFrom,
imagePathTo,
progress
progress,
params
}) => {
gl.clear(gl.COLOR_BUFFER_BIT)

Expand All @@ -54,7 +55,7 @@ module.exports = (opts) => {
textureTo.magFilter = gl.LINEAR

buffer.bind()
transition.draw(progress, textureFrom, textureTo)
transition.draw(progress, textureFrom, textureTo, gl.drawingBufferWidth, gl.drawingBufferHeight, params)

textureFrom.dispose()
textureTo.dispose()
Expand Down
6 changes: 4 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ await concat({
],
transition: {
name: 'directionalWipe',
duration: 500
duration: 500,
params: {direction: [1, -1]}
}
})
```
Expand Down Expand Up @@ -148,7 +149,8 @@ Note that you must specify either `transition` or `transitions`, depending on ho
// example
const transition = {
duration: 1000, // ms
name: 'directionalwipe' // gl-transition name to use (will match with lower-casing)
name: 'directionalwipe', // gl-transition name to use (will match with lower-casing)
params: {direction: [1, -1]} // optionally override default parameters
}
```

Expand Down

0 comments on commit 972570a

Please sign in to comment.