Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit authored Jun 20, 2018
2 parents f41685c + 5550538 commit cbd66d9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/init-frames.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ module.exports.initScene = async (opts) => {
scene.transition = {
name: 'fade',
duration: 500,
params: { },
...t
}

Expand Down
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
7 changes: 5 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ await concat({
},
{
name: 'directionalWarp',
duration: 500
duration: 500,
// pass custom params to a transition
params: { direction: [ 1, -1 ] }
},
{
name: 'squaresWire',
Expand Down Expand Up @@ -148,7 +150,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 cbd66d9

Please sign in to comment.