This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--------------------------------------------------------------------------// | |
// Force field animator by Etienne Jacob (www.necessary-disorder.tumblr.com)// | |
// Processing code (https://processing.org) // | |
// Saves frames, then you must use something else to make the GIF // | |
//--------------------------------------------------------------------------// | |
/// This code starts with the rendering system I took from @beesandbombs | |
/// (it also contains some useful functions and stuff) | |
/// You don't have to understand it | |
/// Just know that it does an average on many drawings to get a motion blur effect | |
/// from drawings parametrized by the global variable t going from 0 to 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--------------------------------------------------------------------------// | |
// Force field animator by Etienne Jacob (www.necessary-disorder.tumblr.com)// | |
// Processing code (https://processing.org) // | |
// Saves frames, then you must use something else to make the GIF // | |
//--------------------------------------------------------------------------// | |
/// This code starts with the rendering system I took from @beesandbombs | |
/// (it also contains some useful functions and stuff) | |
/// You don't have to understand it | |
/// Just know that it does an average on many drawings to get a motion blur effect | |
/// from drawings parametrized by the global variable t going from 0 to 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
size(500, 500); | |
background(0); | |
smooth(8); | |
noFill(); | |
stroke(235, 15); | |
strokeWeight(0.9); | |
x1=y1=-3; | |
x2=y2=3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
size(600, 600); | |
background(0); | |
smooth(8); | |
noFill(); | |
stroke(235, 15); | |
strokeWeight(0.9); | |
x1=y1=-3; | |
x2=y2=3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Field example | |
PVector field(float x,float y){ | |
float ns = 20*noise(0.01*x,0.01*y); | |
return new PVector(1.0*cos(ns),1.0*sin(ns)); | |
} | |
/* | |
// Flow field | |
float dt = 0.1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup(){ | |
size(500,500); | |
background(0); | |
} | |
float a1 = 1.0,a2 = 1.2,a3 = 1.0,a4 = 1.5; | |
float d1 = 0.00002,d2 = 0.00002,d3 = 0.0005,d4 = 0.00002; | |
float f1 = 1,f2 = 2, f3 = 3.2,f4 = 4.1; | |
float p1 = 0,p2 = 0,p3 = 0,p4 = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// note : if you're on github gist and want to copy paste this code, you can click on the "Raw" button | |
// and then do Ctrl A, Ctrl C, Ctrl V | |
// (code below by Kurt Spencer, slightly modified code to run as Processing tab) | |
// maybe you should rather use this new (improved) version of the noise instead : https://github.com/KdotJPG/OpenSimplex2 | |
/* | |
* OpenSimplex Noise in Java. | |
* by Kurt Spencer | |
* | |
* v1.1 (October 5, 2014) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OpenSimplexNoise noise; | |
int[][] result; | |
float t, c; | |
float ease(float p) { | |
return 3*p*p - 2*p*p*p; | |
} | |
float ease(float p, float g) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int numFrames = 100; | |
PVector field(float x,float y){ | |
float amount = 2.5; | |
float scale = 0.03; | |
float radius = 0.45; | |
double value1 = 400.0*noise.eval(scale*x,scale*y,radius*cos(TWO_PI*1.0*(frameCount-1)/numFrames),radius*sin(TWO_PI*1.0*(frameCount-1)/numFrames)); | |
double value2 = 400.0*noise.eval(1000+scale*x,scale*y,radius*cos(TWO_PI*1.0*(frameCount-1)/numFrames),radius*sin(TWO_PI*1.0*(frameCount-1)/numFrames)); | |
//int value2 = (int) Math.round(value); | |
float parameter1 = (int) Math.round(value1)/100.0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OpenSimplexNoise noise; | |
void setup(){ | |
size(500,500); | |
noise = new OpenSimplexNoise(); | |
} | |
int spacing = 15; | |
int numFrames = 100; |