- Base URL: https://editor.p5js.org/
- Only the success responses are mentioned below. For each of the following, in case of an error, an error message will be present in the response, in the format
"message": "error message"
| p5.prototype._initVals = function () { | |
| this.int_zoom = 1; | |
| this.int_offset = this.createVector(0, 0); | |
| this.mouseWheel = mouseWheel1.bind(this) | |
| this.mouseDragged = mouseDragged1.bind(this) | |
| }; | |
| p5.prototype.registerMethod('init', p5.prototype._initVals) |
| // MouseDrag - movable canvas | |
| // p5.js | |
| // function draw() | |
| // translate(offset) | |
| // .. | |
| // } | |
| function mouseDragged(event) { | |
| offset.add(event.movementX * 0.9, event.movementY * 0.9) |
"message": "error message"
(This gist is outdated. This script has been added into the official repo.)
Original Version (old website): https://github.com/CodingTrain/website-archive/blob/main/_scripts/generate-youtube-descriptions.js
This is a draft version of the description generator script to work with the new website.
| const w = 400, h = 400 | |
| setupWindow(w, h) | |
| const p5 = require("p5") | |
| new p5(p => { | |
| // Declare sketch variables here | |
| p.setup = () => { | |
| p.createCanvas(w, h) | |
| // setup function |
| const w = 400, h = 400 | |
| setupWindow(w, h) | |
| // import required even though the variable "p5" will not be used anywhere | |
| const p5 = require("p5") | |
| // Declare sketch variables here | |
| function setup() { | |
| createCanvas(w, h); |
These are the mandatory window properties accessed by p5.js on import, and what can be used instead:
By default, there is no requestAnimationFrame in node.
p5 has a polyfill for requestAnimationFrame for older browsers, so we don't need to implement anything.
{