Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Object.keys(this.lines).forEach((linekey) => {
const line = this.lines[linekey]
const circleA = this.circles[line.circleIndices[0]]
const circleB = this.circles[line.circleIndices[1]]
if (this.hasWebGL) {
// TODO: figure out why p5 line() function not working
// with hardware-accel graphics
p.push()
p.beginShape(P5.prototype.LINES)
p.translate(circleA.x, circleA.y, 0)
p.vertex(0, 0, 0)
p.vertex((circleB.x - circleA.x),
(circleB.y - circleA.y),
0)
p.fill(83, 76, 101) // prevent P5 spamming shader uniform warnings
p.stroke(83, 76, 101)
p.endShape()
p.pop()
} else {
p.line(circleA.x, circleA.y, circleB.x, circleB.y)
}
})
}
private loadImage = (path: string, successCallback: (pImg: any) => void, failureCallback: (e: any) => void) => {
const match = /^delir:(.+)/.exec(path)
if (match) {
path = this.resolver.resolveAsset(match[1])!.path
}
return P5.prototype.loadImage.call(this.p5, path, successCallback, failureCallback)
}
}