How to use the p5/lib/p5.min 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 nitin42 / Elements-of-physics / simulator / components / hoc.js View on Github external
getCanvas = () =>
      new p5(p => {
        this.instance = p

        this.renderer(p)

        // Do some extra stuff here with processing
        this.props.extras && this.props.extras(p)
      }, this.wrapper)
github nitin42 / Elements-of-physics / src / module-build.js View on Github external
(_this.getCanvas = function() {
          return new p5(function(p) {
            _this.instance = p

            _this.renderer(p)

            // Do some extra stuff here with processing
            _this.props.extras && _this.props.extras(p)
          }, _this.wrapper)
        }),
        _temp)),
github stc / HackPact / Day-01-Harmonic-Motion / src / index.js View on Github external
colors[i] -= 4;
		}
	}
	p.keyPressed = () => {
		if(p.key == 'm') {
			p.save(Date.now() + ".jpg");
		}
	}
	p.mousePressed = () => {
		StartAudioContext(Tone.context).then(function(){});
	}
}

export default sketch;

new p5(sketch);
github stc / HackPact / Day-30-Birds-On-Wires / src / index.js View on Github external
}
    }

    p.mousePressed = () => {
        StartAudioContext(Tone.context).then(function(){});    
    }

    function circle(x, y, r) {
        p.push();
        p.translate(x, y, r);
        p.sphere(1 + r/2);
        p.pop();
    }
}
export default sketch;
new p5(sketch);
github stc / HackPact / Day-13-Latent-Space / src / index.js View on Github external
quantizedStartStep: 26,
                quantizedEndStep: 28
            }, {
                pitch: pitches2[Math.floor(Math.random() * pitches2.length - 1)],
                quantizedStartStep: 28,
                quantizedEndStep: 30
            }, {
                pitch: pitches2[Math.floor(Math.random() * pitches2.length - 1)],
                quantizedStartStep: 30,
                quantizedEndStep: 32
            }, ]
        };
    }
}
export default sketch;
new p5(sketch);
github stc / HackPact / Day-11-Mechanical-Folk / src / index.js View on Github external
b.alpha = 255;
		}

		counter++;
		if(counter>5) {
			counter = 0;
			lineIndex++;
			if(lineIndex>3) {
				lineIndex = 0;
			}
		}	
	}
}

export default sketch;
new p5(sketch);
github stc / HackPact / Day-19-Circulation / src / index.js View on Github external
}

    }
    p.keyPressed = () => {
        if(p.key == 'm') {
            p.save(Date.now() + ".jpg");
        }
    }

    p.mousePressed = () => {
        StartAudioContext(Tone.context).then(function(){});
    }
    
}
export default sketch;
new p5(sketch);
github stc / HackPact / Day-16-Granular-Separation / src / index.js View on Github external
loaded = true;
        player.start();
    }

    p.mousePressed = () => {
        //sampler.detune = p.ceil(p.random(4)) * 1000;
        StartAudioContext(Tone.context).then(function(){});
    }

    function newVec(x,y) {
        let vec = p5.Vector.fromAngle(p.millis()*speed + x*weaveFactors.x + y*weaveFactors.y, circleSize/2)
        return vec;
    }
}
export default sketch;
new p5(sketch);
github stc / HackPact / Day-12-Sorting-Algorithms / src / index.js View on Github external
sortPass(++i);
                } else {   
                	        
                    sortPass(++i);
                }

            } else {
                bubbleSort();
            }
        }
        if(sortedCount<100)sortPass(1);
    }
}

export default sketch;
new p5(sketch);
github stc / HackPact / Day-18-Initial-Conditions / src / index.js View on Github external
pendulums2[i].draw();
        }
    }

    p.keyPressed = () => {
        if(p.key == 'm') {
            p.save(Date.now() + ".jpg");
        }
    }

    p.mousePressed = () => {
        StartAudioContext(Tone.context).then(function(){});
    }
}
export default sketch;
new p5(sketch);

p5

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

LGPL-2.1
Latest version published 25 days ago

Package Health Score

95 / 100
Full package analysis