Skip to content

Instantly share code, notes, and snippets.

@npisanti
Last active May 11, 2019 22:05
Show Gist options
  • Save npisanti/0f977f0aa047df0245daa4aef5ecff34 to your computer and use it in GitHub Desktop.
Save npisanti/0f977f0aa047df0245daa4aef5ecff34 to your computer and use it in GitHub Desktop.
euclid
'use strict'
import Operator from '../operator.js'
export default function OperatorU (orca, x, y, passive) {
Operator.call(this, orca, x, y, 'u', passive)
this.name = 'Uclid'
this.info = 'Bangs based on the Euclidean pattern.'
this.ports.haste.step = { x: -1, y: 0, clamp: { min: 1 } }
this.ports.input.max = { x: 1, y: 0, clamp: { min: 1 }, default: '8' }
this.ports.output = { x: 0, y: 1, bang: true }
this.operation = function (force = false) {
const step = this.listen(this.ports.haste.step, true)
const max = this.listen(this.ports.input.max, true)
const bucket = (step * (orca.f + max - 1)) % max + step
return bucket >= max
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment