How to use the p5.prototype function in p5

To help you get started, we’ve selected a few p5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AugurProject / augur / src / modules / common / components / graph-background / graph-background.jsx View on Github external
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)
      }
    })
  }
github ra-gg / Delir / packages / core / src / Engine / Renderer / P5js / P5Hooks.ts View on Github external
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)
  }
}

p5

[![npm version](https://badge.fury.io/js/p5.svg)](https://www.npmjs.com/package/p5)

LGPL-2.1
Latest version published 5 days ago

Package Health Score

95 / 100
Full package analysis