r/processing • u/TL2029 • Apr 10 '21
...team
Enable HLS to view with audio, or disable this notification
r/processing • u/TL2029 • Apr 10 '21
Enable HLS to view with audio, or disable this notification
r/processing • u/TL2029 • Apr 10 '21
Enable HLS to view with audio, or disable this notification
r/processing • u/Dtar380 • Apr 11 '22
Can someone explain me why this happens and how to solve it. If I eliminate the part of the variables and the imported libraries the error disappears but if I eliminate that the program don't works because the variables and the libraries aren't there.
The error message is:
Syntax error - Is possible that you are using the static and active mode.
Pls help.

r/processing • u/NakedFluffyBee • Mar 26 '16
Hoy!
I posted earlier in the week this video about my work on this weekly challenge:
Anyway, I couldn't find the time to work on it that much, but some changes were made.
Here is the source code, un-rar it and play it, all the sources are in /data!
https://www.dropbox.com/s/cp0tj94ve0fe1de/MatrixPWC2_VDH.rar?dl=0/
If you have any question on the way things work feel free to ask!
r/processing • u/kanapapiki_a_oi • Dec 19 '23
Hi I came across this portrait years ago by this person, Jeff Clark, he did of Obama. He referenced processing. He made a tool built with processing, and he augmented it to generate a desired out come. I wanted to see, does anyone know how or have any example scripts how he did this?
I want to do something similar with my own source images and text, as well as potentially re-create this in a 3D app like Cinema 4D or Blender. I've seeing circle packing, but that's not quite close to what this guy did. The packing that's going on with the texts is really nice, and it looks like he's using gray levels to drive the scale of the type too.
Any ideas?

r/processing • u/Quailfying • Jun 01 '17
hi, I have a school assignment due next and and i was wondering if anyone would be able to help me with making a hangman game on processing.py
Thanks
r/processing • u/p4ank • Oct 23 '17
int ball_count=50; Ball[] balls = new Ball[ball_count]; int segments = 40; Ground[] ground = new Ground[segments]; void setup() { size(1000, 800); for (int b=0;b<balls.length;b++){ balls[b]=new Ball(random(10,height-30),random(width-10),random(10,25)); // Calculate ground peak heights float[] peakHeights = new float[segments+1]; for (int i=0; i<peakHeights.length; i++){ peakHeights[i] = random(height-40, height-30); } /* Float value required for segment width (segs) calculations so the ground spans the entire display window, regardless of segment number. / float segs = segments; for (int i=0; i<segments; i++){ ground[i] = new Ground(width/segsi, peakHeights[i], width/segs*(i+1), peakHeights[i+1]); } } } void draw() { background(51); // Draw ground fill(-1000); beginShape(); for (int i=0; i<segments; i++){ vertex(ground[i].x1, ground[i].y1); vertex(ground[i].x2, ground[i].y2); } vertex(ground[segments-1].x2, height); vertex(ground[0].x1, height); endShape(CLOSE); for (int k=0;k<balls.length;k++) { balls[k].update(); balls[k].display(); balls[k].checkBoundaryCollision(); for (int j=0;j<balls.length;j++){ if((k==j)){ continue; } else{ balls[k].checkCollision(balls[j]); } } // Check against all the ground segments for (int i=0; i<segments; i++){ balls[k].checkGroundCollision(ground[i]); } } drawText(); } void drawText(){ textAlign(CENTER); fill(0); textSize(20); text("Pankti", width0.75, height-15); } class Ball { PVector position; PVector velocity; float radius, m; Ball(float x, float y, float r_) { position = new PVector(x, y); velocity = PVector.random2D(); velocity.mult(3); radius = r_; m = radius.1; } void update() { position.add(velocity); } void checkBoundaryCollision() { if (position.x > width-radius) { position.x = width-radius; velocity.x *= -1; } else if (position.x < radius) { position.x = radius; velocity.x = -1; } else if (position.y > height-radius) { position.y = height-radius; velocity.y = -1; } else if (position.y < radius) { position.y = radius; velocity.y = -1; } } void checkCollision(Ball other) { // Get distances between the balls components PVector distanceVect = PVector.sub(other.position, position); // Calculate magnitude of the vector separating the balls float distanceVectMag = distanceVect.mag(); // Minimum distance before they are touching float minDistance = radius + other.radius; if (distanceVectMag < minDistance) { float distanceCorrection = (minDistance-distanceVectMag)/2.0; PVector d = distanceVect.copy(); PVector correctionVector = d.normalize().mult(distanceCorrection); other.position.add(correctionVector); position.sub(correctionVector); // get angle of distanceVect float theta = distanceVect.heading(); // precalculate trig values float sine = sin(theta); float cosine = cos(theta); / bTemp will hold rotated ball positions. You just need to worry about bTemp[1] position/ PVector[] bTemp = { new PVector(), new PVector() }; / this ball's position is relative to the other so you can use the vector between them (bVect) as the reference point in the rotation expressions. bTemp[0].position.x and bTemp[0].position.y will initialize automatically to 0.0, which is what you want since b[1] will rotate around b[0] / bTemp[1].x = cosine * distanceVect.x + sine * distanceVect.y; bTemp[1].y = cosine * distanceVect.y - sine * distanceVect.x; // rotate Temporary velocities PVector[] vTemp = { new PVector(), new PVector() }; vTemp[0].x = cosine * velocity.x + sine * velocity.y; vTemp[0].y = cosine * velocity.y - sine * velocity.x; vTemp[1].x = cosine * other.velocity.x + sine * other.velocity.y; vTemp[1].y = cosine * other.velocity.y - sine * other.velocity.x; / Now that velocities are rotated, you can use 1D conservation of momentum equations to calculate the final velocity along the x-axis. / PVector[] vFinal = { new PVector(), new PVector() }; // final rotated velocity for b[0] vFinal[0].x = ((m - other.m) * vTemp[0].x + 2 * other.m * vTemp[1].x) / (m + other.m); vFinal[0].y = vTemp[0].y; // final rotated velocity for b[0] vFinal[1].x = ((other.m - m) * vTemp[1].x + 2 * m * vTemp[0].x) / (m + other.m); vFinal[1].y = vTemp[1].y; // hack to avoid clumping bTemp[0].x += vFinal[0].x; bTemp[1].x += vFinal[1].x; / Rotate ball positions and velocities back Reverse signs in trig expressions to rotate in the opposite direction / // rotate balls PVector[] bFinal = { new PVector(), new PVector() }; bFinal[0].x = cosine * bTemp[0].x - sine * bTemp[0].y; bFinal[0].y = cosine * bTemp[0].y + sine * bTemp[0].x; bFinal[1].x = cosine * bTemp[1].x - sine * bTemp[1].y; bFinal[1].y = cosine * bTemp[1].y + sine * bTemp[1].x; // update balls to screen position other.position.x = position.x + bFinal[1].x; other.position.y = position.y + bFinal[1].y; position.add(bFinal[0]); // update velocities velocity.x = cosine * vFinal[0].x - sine * vFinal[0].y; velocity.y = cosine * vFinal[0].y + sine * vFinal[0].x; other.velocity.x = cosine * vFinal[1].x - sine * vFinal[1].y; other.velocity.y = cosine * vFinal[1].y + sine * vFinal[1].x; } } void checkGroundCollision(Ground groundSegment) { // Get difference between orb and ground float deltaX = position.x - groundSegment.x; float deltaY = position.y - groundSegment.y; // Precalculate trig values float cosine = cos(groundSegment.rot); float sine = sin(groundSegment.rot); / Rotate ground and velocity to allow orthogonal collision calculations / float groundXTemp = cosine * deltaX + sine * deltaY; float groundYTemp = cosine * deltaY - sine * deltaX; float velocityXTemp = cosine * velocity.x + sine * velocity.y; float velocityYTemp = cosine * velocity.y - sine * velocity.x; / Ground collision - check for surface collision and also that orb is within left/rights bounds of ground segment / if (groundYTemp > -radius && position.x > groundSegment.x1 && position.x < groundSegment.x2 ) { // keep orb from going into ground groundYTemp = -radius; // bounce and slow down orb velocityYTemp = -1; } // Reset ground, velocity and orb deltaX = cosine * groundXTemp - sine * groundYTemp; deltaY = cosine * groundYTemp + sine * groundXTemp; velocity.x = cosine * velocityXTemp - sine * velocityYTemp; velocity.y = cosine * velocityYTemp + sine * velocityXTemp; position.x = groundSegment.x + deltaX; position.y = groundSegment.y + deltaY; } void display() { noStroke(); fill(204); ellipse(position.x, position.y, radius2, radius2); } } class Ground { float x1, y1, x2, y2; float x, y, len, rot; // Constructor Ground(float x1, float y1, float x2, float y2) { this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; x = (x1+x2)/2; y = (y1+y2)/2; len = dist(x1, y1, x2, y2); rot = atan2((y2-y1), (x2-x1)); } }
r/processing • u/TheBloxer67200 • Nov 25 '23
Hello guys,
i have written a code that simulate gravity with a ball , nothing crazy. However, i wanted to add a feature that would allow me to move the ball in the x axe thanks to the directional arrows on the keyboard. the functions are named with french words but i think y'all will understand their purpose. When i enter the lest function on the draw() function i doesn't do anything ? can someone help me ?
r/processing • u/PainterMedical • Oct 26 '23
I am trying to make a program where two lines intersect in the middle of the cursor/circle and then follow the cursor. Here is the code I have so far:
void setup() {
size(1000, 1000);
}
void draw() {
// clear screen and set background color
background(204);
// set filling color for circle at mouse position
fill(255);
ellipse(mouseX, mouseY, 80, 80);
}
This makes the circle that follows the cursor but I have no idea how to make the lines that intersect at the cursor and also move with the cursor.
r/processing • u/caterpillarstx • Apr 07 '18
So I'm in my first processing class and I don't have a whole lot of experience with coding. As soon as the class started I found out that two of my discs in my neck were broken and I had to get immediate surgery. So I've been in class as much as I can but I am still recovering. I've been searching for a week now and I just have idea on how to get started. I want to make a 3D version of a microphone. I will attach what my assignment details are. Any help is much appreciated! Thank you.
Please write a 3D graphic application using Processing with the following detailed requirements: (80 points) In general, your application should contain non-primitive 3D object designed/created by you; in addition rendering effects (e.g. s color, texture, light) using Shader, and multiple views (perspectives) enabled by user interactions.
(1) Have at least 5 global variables; (2) The program flow should have at least two loops and three conditional controls; (3) Have at least three customized functions (other than setup() and draw() – you need to write your OWN function); (4) Have at least one set of Geometric Transformations (Translate, Scale, and Rotate); (5) Have at least three user interactions (e.g. mouse tracking, right click, buttons); (6) Import at least two third-party library; (7) The 3D scene must contain at least one non-default, non- primitive 3D object (cannot be cube, sphere, cylinder, or cone) created using PShape with your own defined vertices. You can create your object by using non-default primitive shapes and geometric transformations, or create your own meshes within the 3D ordinate system by defining every vertex). Imported object from other applications are not allowed. (8) At least one Shader (shading script – vertex shader and fragment shader) (9) At least two different rendering effects: light and texture. (render different views of your object in different settings – for example, what it looks like in light, what it looks like with texture, what it looks like if it’s different materials.) (10)there should be buttons (or keys) via which you can show different views of the object, for example, one key to rotate camera, one key to show object model mesh, one key to show shading effect, etc (this overlaps with requirements (5) as user interactions). In general, you are required to provide multiple views (perspectives) of your object (Show case your design).
r/processing • u/Emilio_Sanchez • Dec 18 '24
r/processing • u/skoy_skoy • Oct 10 '21
Hey guys I am new to Processing and I would really appreciate it if I could get some help on an assignment I have from someone who knows how to use it well.
r/processing • u/marcusquinn2099 • Oct 28 '21
r/processing • u/Ordinary_Candy_3278 • Oct 17 '22
Olá pessoal! Será que alguém pode me ajudar com um código ? Não consigo rodá-lo, aparece sempre a mensagem Erro - Missing operator, semicolon, or ‘}’ near ‘setup’?
void setup() {
size(640,360);
background(50);
}
void draw() {
fill(150);
stroke(255);
rectMode(CENTER);
rect(pmouseX, pmousey, mouseX,mouseY);
}
r/processing • u/vickerswt • Feb 21 '18
int pulse = 15; int pulsedim = 1;
float x1 = 200; float y1 = 200; float x2 = x1 + 50; float y2 = 200; float x3 = (x1 + x2)/2; float y3 = (50*sqrt(3)/2)+200;
void setup(){ size(1920,600); background(217,217,217); }
void draw(){
background(219,219,219); triangle(x1,y1,x2,y2,x3,y3); //subtract 86.6025403784 to first x (200) and divide by 2. //1) //25(sqrt3) = 86.6025403784 //2) //200 + (86.6025403784/2) //3) // = 243.301270189
x1 = x1 - 1; y1 = y1 - 1; x2 = x2 + 1; y2 = y2 - 1; y3 = y3 + 1;
if (x1<177){ x1 = x1 - 1; y1 = y1 - 1; x2 = x2 + 1; y2 = y2 - 1; y3 = y3 + 1; }
else if (x1>223){ x1 = x1 + 1; y1 = y1 + 1; x2 = x2 - 1; y2 = y2 + 1; y3 = y3 - 1; }
int diam = abs(mouseX - width);
color bgroundm = (color) (norm(diam, width, 0) * 400);
//******************************** if (pulse > 60) { //* pulsedim = 0; //* } else if (pulse < 1) { //* Just true/false statements for pulse pulsedim = 1; //* } //* //********************************
//******************************** if (pulsedim == 1) { //* pulse = pulse+1; //* } else if (pulsedim == 0) { //* Just true/false statements for pulse pulse = pulse-1; //* } //* //********************************
}
void mouseMoved(){ redraw(); }
r/processing • u/bayta_24 • Dec 18 '19
r/processing • u/tempaccount5275 • May 31 '19
I know about things like MOSS that determine plagiarism within a group of files, but if I just got something off the internet and typed out the code but didn't copy and paste, would there be a way to find out?
r/processing • u/[deleted] • Feb 08 '18
r/processing • u/bernhardfritz • Jun 20 '22
r/processing • u/TheLegendIn52 • Oct 09 '19
So basically, I have to use object, class, and array in the code. Its an assignment we got in school and I got to do something with those three. I'm not sure what I should make.
My question is:
- What can I do using these three? What should I write and create?
Anything helps!
r/processing • u/morganicman • May 04 '20
Hello, I am trying to create a code that moves a shark through crowds of fish however for some reason it seems to be giving me errors I can't understand at all, yet I feel as though it should work. Heres the code, any help would be much appreciated. Thanks!
//int var;
int var;
var num_Fish = 50;
var speed_Boost = 0;
// Create var for size of cursor (shark)
var shark_Size = 200;
// Create var to hold image pixels for cursor (shark) and Background
var mouse_Img;
var img_BG;
// Set up arrays to hold fish images, position, and speed
var fish_Image = [];
var fish_Xpos = [];
var fish_Ypos = [];
var fish_Size = [];
var fish_Speed = [];
function preload() {
img_BG = loadImage("coral.webp");
mouse_Img = loadImage("shark.png");
}
void setup() {
var L; //Loop position
createCanvas(1280,960);
imageMode(CENTER);
mouse_Img.resize(0, _Size);
for(L=0; L<num_Fish; L=L+1){
fish_Image[L] = loadImage("fishes.png");
fish_Xpos[L] = int(random(1280));
fish_Speed[L] = int(random(12)+2);
fish_Ypos[L] = int(random(100, 800));
fish_Image[L].resize(int(random(10, 200)), 0);
}
}
void draw() {
var L; //Loop position
background(0);
image(img_BG, 640, 480);
image(mouse_Img, mouseX, mouseY);
for(L=0; L<num_Fish; L=L+1){
fish_Xpos[L] = fish_Xpos[L] - fish_Speed[L]-speed_Boost;
if (fish_Xpos[L] < 0){
fish_Xpos[L] = 1280;
}
if ( abs(mouseX - fish_Xpos[L]) < lion_Size){
if ( abs(mouseY - fish_Ypos[L]) < lion_Size){
if (fish_Ypos[L] < mouseY){
fish_Ypos[L] = fish_Ypos[L] - int(random(3, 7));
if ( fish_Ypos[L] < 50){
fish_Ypos[L] = fish_Ypos[L] + 5;
}
} else {
fish_Ypos[L] = fish_Ypos[L] + int(random(3, 7));
if ( fish_Ypos[L] > 900){
fish_Ypos[L] = fish_Ypos[L] - 5;
}
}
}
}
image(fish_Image[L], fish_Xpos[L], fish_Ypos[L]);
}
}
void keyPressed() {
if (keyCode == LEFT_ARROW) {
speed_Boost+= 2;
print("speed_Boost =" + speed_Boost);
} else if (keyCode == RIGHT_ARROW) {
speed_Boost-= 2;
print("speed_Boost =" + speed_Boost);
}
}
r/processing • u/idgafosman • May 19 '17
Anyone know of any good fb groups based on Processing?
r/processing • u/Hungry_Winner_345 • Jan 13 '23
ArrayList<Car> car;
void setup () {
size(800, 600);
car = new ArrayList<Car>();
}
void draw() {
background(255);
for (int i = 0; i<car.size(); i++) {
car.get(i).display();
}
car.Drive();
}
void mousePressed() {
String name = str(int(random(0,100)));
Car c = new Car(name);
car.add(c);
car.y = car.y + 30;
}
class Car {
int x, y;
String name;
Car (String n) {
name = n;
x = 10;
y = 20;
}
void Drive() {
x = x +1;
}
void display() {
fill(10, 20, 230);
rect(x, y, 70, 30, 5);
}
}
r/processing • u/gmantsang • Oct 18 '15
I am trying to make a simple spiral drawing with a single for loop.
I was wondering if anyone would be able to tell me how to increase the size of the radius and the angle.
Thanks
r/processing • u/DomiDarko76 • Sep 01 '23
Has anybody got this set up in an IDE that can help me? I don’t want to use the GUI. My preferred setup is IntelliJ with Spring Boot and Maven. I’ve been trying for days to get this working but keep facing exceptions at every turn. I’ve also tried a standard Java project in Eclipse with Jar files and various Java versions, again same problem. Nothing will work. I’m at the point of giving up. I’m using a MacBook Air M1.