Skip to content

Instantly share code, notes, and snippets.

View KrabCode's full-sized avatar

Jakub Rak KrabCode

  • Prague, Czech Republic
  • 11:30 (UTC +02:00)
View GitHub Profile
import processing.core.PApplet;
import processing.core.PVector;
import java.util.ArrayList;
PVector target, cameraOffset;
float centerToCornerDistance, farAway;
float alignRadius, alignWeight, centralizeRadius, centralizeWeight;
float spdLimit = 10;
int fishCount = 50;
Fish player;
@KrabCode
KrabCode / MainApp.java
Created June 7, 2019 17:39
Fish flocking simulation
import processing.core.PApplet;
import processing.core.PVector;
import java.util.ArrayList;
public class MainApp extends PApplet {
PVector target, cameraOffset;
float centerToCornerDistance, farAway;
float alignRadius, alignWeight, centralizeRadius, centralizeWeight;
/*{
"pixelRatio": 1
}*/
precision highp float;
uniform float time;
uniform vec2 resolution;
uniform sampler2D backbuffer;
const float pi = 3.14159265359;
import peasy.PeasyCam;
import processing.core.PApplet;
import processing.core.PGraphics;
import processing.core.PVector;
import processing.opengl.PShader;
import java.util.ArrayList;
public class MainApp extends PApplet {
@KrabCode
KrabCode / src_MainApp.java
Created June 1, 2019 11:58
2D water ripple shader
import processing.core.PApplet;
import processing.core.PGraphics;
import processing.opengl.PShader;
public class MainApp extends PApplet {
public static void main(String[] args) {
PApplet.main("MainApp");
}
PShader waterShader;
@KrabCode
KrabCode / background.html
Created May 30, 2019 13:58
Moving Mountain Background for Wallpaper Engine Single Folder Setup
<!DOCTYPE html>
<html>
<head>
<title>Mountain</title>
<link rel="shortcut icon" type="image/png" href="https://krabcode.github.io/favicon.png"/>
<link rel="stylesheet" href="sketch.css">
<script src="p5.js"></script>
<script src="sketch.js"></script>
</head>
<body>
ArrayList<String> log = new ArrayList<String>();
boolean scrollbarBeingDragged = false;
float windowOffsetY = 0;
float handleOffsetY = 0;
int fontSize = 20;
int lastMouseWheelEvent = 0;
void setup() {
size(800, 800);
for (int i = 0; i < 30; i++) {
float t;
void setup() {
fullScreen(P2D);
}
void draw() {
t = radians(frameCount);
background(0);
pushMatrix();
@KrabCode
KrabCode / Colorsort.pde
Created May 8, 2019 22:21
Noise directed pixel sort
import java.util.UUID;
PImage src;
PGraphics temp;
PVector[] directions;
public void settings() {
// fullScreen(P2D, 2);
size(800, 800, P2D);
}
@KrabCode
KrabCode / sliders.pde
Last active June 4, 2019 11:05
easy plug and play sliders for Processing
float back, fill, stroke, weight, rotationZ, rotationYspeed, size;
void setup() {
size(800, 800, P3D);
//fullScreen(P3D);
}
void draw() {
background(back);
fill(fill);