Skip to content

Instantly share code, notes, and snippets.

@positlabs
Created July 18, 2020 15:44
Show Gist options
  • Save positlabs/5fda638fc6701905883d06029e35009b to your computer and use it in GitHub Desktop.
Save positlabs/5fda638fc6701905883d06029e35009b to your computer and use it in GitHub Desktop.
Spark frame pulse
const R = require('Reactive')
const Patches = require('Patches')
const Animation = require('Animation')
let frame = 0
const td = Animation.timeDriver({durationMilliseconds: 1, loopCount: Infinity, mirror: false})
td.onAfterIteration().subscribe(() => {
frame ++
Patches.inputs.setScalar('currentFrame', frame)
Patches.inputs.setPulse('frame', R.once())
})
td.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment