Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
making yet another processing gui library

Krab KrabCode

🤖
making yet another processing gui library
View GitHub Profile
@KrabCode
KrabCode / rect_sphere_study.pde
Created Nov 29, 2022
cooler solution for equal spacing than angular diameter but I have no idea how it works...
View rect_sphere_study.pde
float t = 1, x, y;
float sx, sy;
float rectSize = 30;
PMatrix3D mouseRotation = new PMatrix3D();
void setup() {
fullScreen(P3D);
rectMode(CENTER);
}
View TreeMock.pde
void setup() {
NodeFolder root = new NodeFolder("root");
root.addChild(new IntNode("nerdsSniped", 32));
root.addChild(new StringNode("cheese", "gouda"));
NodeFolder cats = new NodeFolder("cats");
cats.addChild(new IntNode("kittens", 3));
cats.addChild(new IntNode("chomkers", 7));
StringNode catSentiment = new StringNode("sentiment", "cute");
cats.addChild(catSentiment);
View FadedHuePickerWheel.pde
float radiusA = 200;
float radiusB = 300;
float fadeSize = 10;
int detail = 1000;
void setup() {
size(800, 800, P2D);
colorMode(HSB, 1, 1, 1, 1);
}
View Noita save backup.cmd
echo off
title noita backup
echo.
set noitaSaveLocation=%AppData%\..\LocalLow\Nolla_Games_Noita\save00
set /p dirName= New backup folder name:
robocopy "%noitaSaveLocation%" "%dirName%\save00" /s /e
echo Current noita save backed up as: %dirName%
echo.
pause
View APDE_Blood.pde
// TODO
// Extract key variables to the top
// Sinewave water level
// Drain blood somehow
ArrayList<P> ps = new ArrayList<P>();
ArrayList<L> ls = new ArrayList<L>();
float levelY;
void setup(){
View Mandala.pde
PGraphics pg;
ArrayList<Leaf> leaves = new ArrayList<Leaf>();
ArrayList<Leaf> leavesToRemove = new ArrayList<Leaf>();
int lifeDuration;
public void setup() {
fullScreen(P2D);
pg = createGraphics(width, height, P2D);
}
@KrabCode
KrabCode / feedback.glsl
Last active Mar 29, 2022
Simple feedback effect in processing / glsl... feedback.glsl belongs in the data folder
View feedback.glsl
uniform sampler2D texture; // the current canvas is passed to this shader in Processing as "texture" which is a bad name for it but whatever
uniform vec2 resolution; //set automatically by Processing
uniform float time; //set manually in code
void main(){
vec2 uv = gl_FragCoord.xy / resolution.xy; // coordinate with 0,0 at bottom left, and 1,1 at top right
vec2 offset = vec2(cos(time), sin(time)) / resolution.xy; // the rotating offset to sample a neighbour at
vec4 thisPixelColor = texture2D(texture, uv);
vec4 nearPixelColor = texture2D(texture, uv + offset);
vec4 finalColor = mix(thisPixelColor, nearPixelColor, 0.5); // lerp between the two colors, 0.5 specifies how quickly the effect fades into the background
View aaaa.pde
int lineCount = 10;
int charsPerLine = 50;
int step;
PFont discordFont;
void setup() {
size(600, 200);
discordFont = createFont("Uni Sans Regular.ttf", 16);
View ExampleSketch.java
import processing.core.PApplet;
public class ExampleSketch extends TransparentApplet{
public static void main(String[] args){
PApplet.main(java.lang.invoke.MethodHandles.lookup().lookupClass());
}
@Override
public void settings(){
View ShaderFeedbackDemo.pde
PShader feedbackShader;
float t;
void setup() {
size(1000, 1000, P2D);
background(0);
feedbackShader = loadShader("feedback.frag");
}
void draw() {