Skip to content

Instantly share code, notes, and snippets.

@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 / 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
*/
@GoToLoop
GoToLoop / ArrayList_Shims.js
Last active November 6, 2020 03:49
ArrayList Polyfill Shims for JS Arrays
// ArrayList Polyfill Shims for JS Arrays (v1.0.1)
// GoToLoop (2020/Nov/05)
// https://Gist.GitHub.com/GoToLoop/a74c5780667f2610097cfc007e53a559
"use strict";
// Add some useful Java list's methods to JS arrays as polyfills:
Object.defineProperties(Array.prototype, {
size: {
value() { // polyfill hack to add method size() to JS arrays
@GoToLoop
GoToLoop / MatrixFrameGL.py
Last active August 24, 2020 09:21
Push/Pop Limit Workaround (Python Mode)
"""
* Push/Pop Limit Workaround (v1.0.5)
* GoToLoop (2020/Aug/22)
*
* Discourse.Processing.org/t/too-many-calls-to-pushmatrix/23411/9
* Gist.GitHub.com/GoToLoop/193d951ef13f212f09e2b2809efc4de0
"""
from processing.opengl import PGraphicsOpenGL
@GoToLoop
GoToLoop / MatrixFrameGL.java
Last active August 23, 2020 02:16
Push/Pop Limit Workaround (Java Mode)
/**
* Push/Pop Limit Workaround (v1.0.1)
* GoToLoop (2020/Aug/22)
*
* Discourse.Processing.org/t/too-many-calls-to-pushmatrix/23411/8
* Gist.GitHub.com/GoToLoop/e35ac69e9bd4dbbcce557218c3b20588
*/
// Comment out the package statement below if it's inside a ".java" file:
package processing.core;
@GoToLoop
GoToLoop / .block
Last active January 29, 2021 09:10
Get p5js Version
height: 200
scrolling: no
border: no
license: cc-by-4.0
@GoToLoop
GoToLoop / .block
Last active August 10, 2020 03:44
Brownian Motion
height: 610
scrolling: no
border: no
license: cc-by-4.0
@GoToLoop
GoToLoop / .block
Last active August 10, 2020 03:43
Trailing Deque
height: 600
scrolling: no
border: no
license: cc-by-4.0
@GoToLoop
GoToLoop / .block
Last active August 28, 2019 20:17
Ramer–Douglas–Peucker Algorithm
height: 600
scrolling: no
border: yes
license: cc-by-4.0
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);
}