Skip to content

Instantly share code, notes, and snippets.

@GoToLoop
GoToLoop / README.md
Last active November 27, 2025 15:02
Bash script to install Thonny + py5mode on Linux
@GoToLoop
GoToLoop / README.md
Last active April 16, 2025 23:55
q5js to ESM q5mjs

q5js_to_esm.mjs

🚀 Convert the q5.js library into an ECMAScript Module (ESM) with ease!
This script reads the local q5.js file from subfolder q5 or fetches it from a remote source, applies customizable string replacement patterns, and generates the resulting q5.mjs file in subfolder q5.

📜 Features

  • Local or Remote Input: Automatically handles local files or fetches from a remote URL.
@GoToLoop
GoToLoop / .block
Last active November 13, 2024 17:44
Brownian Motion
height: 610
scrolling: no
border: no
license: cc-by-4.0
/**
* Keyboard Input Library
* Andrew Errity v0.2 (2015-Oct-01)
* GoToLoop v1.0.4 (2015-Oct-22)
*
* https://Forum.Processing.org/two/discussion/13175/
* do-whille-is-not-working-how-it-suppose-to#Item_12
*
* https://GitHub.com/aerrity/Inputs/blob/master/src/Inputs.java
* https://Gist.GitHub.com/GoToLoop/bba0c288aaeeb5ef9bb1
@GoToLoop
GoToLoop / resizeNN.js
Last active June 6, 2023 18:11 — forked from gncgnc/resizeNN.js
Extends p5.Image to handle nearest neighbor resizing for scaling images w/o blurring.
/**
* Resize the image to a new width and height using nearest neighbor algorithm.
* To make the image scale proportionally,
* use 0 as the value for the wide or high parameters.
* For instance, to make the width of an image 150 pixels,
* and change the height using the same proportion, use resize(150, 0).
* Otherwise same usage as the regular resize().
*
* Note: Disproportionate resizing squashes "pixels" from squares to rectangles.
* This works about 10 times slower than the regular resize.
@GoToLoop
GoToLoop / PVector.js
Last active June 3, 2023 14:26
q5.Vector
"use strict";
for (const p of Object.getOwnPropertyNames(Math)) Q5[p] = Math[p];
function Q5(scope, parent) {
const
$ = this, M = Math,
{ _isObj, _isFun, _isNum, _isP5, _val, _argsErr } = Q5;
var
@GoToLoop
GoToLoop / PVector.js
Last active February 13, 2023 05:21
PVector Class Refactoring for PJS
//module.exports = function(options, undef) {
"use strict";
const TAU = 2 * Math.PI,
lerp = (start, stop, amt = 0) => +start + amt*(stop - start),
sq = n => n*n,
pjsCheck = obj => obj != null && 'noLoop' in obj,
argsErr = (mtd, len, min) => {
throw `Too few args passed to ${mtd}() [${len} < ${min}].`;
};
function windowResized() {
const css = getComputedStyle(canvas.parentElement),
mw = float(css.marginLeft) + float(css.marginRight),
mh = float(css.marginTop) + float(css.marginBottom),
ww = float(css.width) || windowWidth,
wh = float(css.height) || windowHeight,
w = round(ww - mw), h = round(wh - mh);
resizeCanvas(w, h, true);
}
@GoToLoop
GoToLoop / adjustFrame.js
Last active November 15, 2022 02:27
Expands Current iFrame Element to Fit Body's Size
'use strict';
function adjustFrameSize() {
if (frameElement) {
frameElement.height = frameElement.frameBorder = 0;
frameElement.height = getDocHeight() + 'px';
frameElement.width = getDocWidth() + 'px';
}
}
@GoToLoop
GoToLoop / HackedMovie.java
Last active October 21, 2022 11:49
Hacked Movie EoS Event
/**
* Hacked Movie EoS Event (v2.1.0)
* by GoToLoop (2022-Oct-20)
*
* Gist.GitHub.com/GoToLoop/67023ba3e9ba1d0301c40f7c030d176a
*
* Discourse.Processing.org/t/hacked-movie-eos-event-library/39375
* Forum.Processing.org/two/discussion/14990/movie-begin-and-end-events#Item_1
*/