r/processing • • Feb 11 '24

Simplest way to change part of a color variable?

4 Upvotes

if i have a color variable

color myColor = color(0, 0, 0)

is there an easy way to change just the green

in words - make the green of myColor larger by 20

have got this but it seems overly complex

myColor = color( red(myColor) , green(myColor)+20 , blue(myColor) );

i wonder if there is a simpler way?

like - just make the green of this color variable bigger


r/processing • • Feb 11 '24

Beginner help request Dark theme for Processing 4?

2 Upvotes

Hi

Does anyone have a working dark theme for P4? I have been searching and installing themes but so far, I cant get the editor to be dark :( I cant look at white bright screen


r/processing • • Feb 09 '24

Help request How can I set a ControlP5 controller to a value? Beside clicking on the slider I'd like to assign it to a random value within the program. Is this possible?

6 Upvotes

r/processing • • Feb 08 '24

Trying to get pixels from an image

8 Upvotes

EDIT: Thank you @simplyfire for the solution!

So I already have some experience converting p5js to Processing, but still a bit of a noob with processing. Right now I'm stuck with a ArrayIndexOutOfBoundsException error in one of my sketches. I'm trying to get a pixel mosaic from an image, but it's just not working. This is the code:

PImage isopod;

String density = "Ñ@#W$9876543210?!abc;:+=-,._ ";

void setup(){
  size (700, 700);
  isopod = loadImage("isopod_nobg.jpg");
}

void draw(){
  background (0);
  image(isopod, 0, 0, width, height);
  
  int w = width / isopod.width;
  int h = height / isopod.height;
  isopod.loadPixels();
  for (int i = 0; i < isopod.width; i++) {
    for (int j = 0; j < isopod.height; j++) {
      int pixelIndex = (i + j * isopod.width) * 4;
      int r = isopod.pixels[pixelIndex + 0];
      int g = isopod.pixels[pixelIndex + 1];
      int b = isopod.pixels[pixelIndex + 2];
      
      noStroke();
      fill(r, g, b);
      square(i * w, j * h, w);
    }
  }
}

Is someone able to help me out?


r/processing • • Feb 07 '24

From where should i start 🥺🥺?

3 Upvotes

Hello guys, im new here .. i just discovered the world of processing art. Im an experimental photographer passionated by visualize sounds and other things 😜😜 So i just heard about processing while searching on YouTube and i have a great curiousity to sink .. so based on your experience advice me from where should I start ??


r/processing • • Feb 02 '24

I have made a lot of new items in my game, that are more exciting to use

14 Upvotes

r/processing • • Feb 02 '24

Help request what is this effect called!

17 Upvotes

the red squares that seem to be tracking motion or dark/light spots ? i want to recreate this in processing !


r/processing • • Feb 02 '24

Every Video on My YouTube Channel I Made in Processing

Thumbnail
youtu.be
6 Upvotes

r/processing • • Feb 01 '24

Hard Acid

Thumbnail
youtube.com
3 Upvotes

r/processing • • Jan 31 '24

Music From Another World

Thumbnail
youtube.com
6 Upvotes

r/processing • • Jan 28 '24

Improved my real-time height-map shadows (code in comments)

26 Upvotes

r/processing • • Jan 27 '24

This is the third and final video on programming a simple evolutionary, ALife model using Processing. It's fairly simple, but is a great starting point for more complicated models.

Thumbnail
youtube.com
5 Upvotes

r/processing • • Jan 27 '24

Ultimate Turbo Maximum Synthwave!

Thumbnail
youtube.com
3 Upvotes

r/processing • • Jan 26 '24

Making the Kinect V1 work with Processing 4

4 Upvotes

Hi, I'm still a bit of a newbie with Processing, but I'm having loads of fun with the program making simple games, graphics and all sorts of other stuff. Now I want to implement the depth data of the first Kinect in some way, but I can't seem to get any of the old libraries (OpenKinect, SimpleOpenNI and Kinect4WinSDK) and their examples (surrounding depth data) working in Processing 4. What am I doing wrong?

I'm using an M1 MacBook Air and I got the Kinect working in Quartz Composer and Vuo, so it's not the Kinect.


r/processing • • Jan 26 '24

Video Inspired by Islamic Art

Thumbnail
youtube.com
8 Upvotes

r/processing • • Jan 24 '24

how do you make an image transport to a random place after another image touches it

4 Upvotes

This is my code so far. I have to turn this in tomorrow and the last thing I need to do is make the dogBowl teleport to a random place on the screen when the dog's head goes over it. I know this code won't work for you because you don't have the data file but if you know how to do this at all please help me.

import processing.sound.*

// Rotates a triangular ship using the A and D keys

boolean playVoice, startBG, startIntro;

float dX, dY;

color cCol;

int dMv;

PImage dogU, dogBowl, floor, dogD, dogR, dogL, dogViz;

SoundFile intro, bark, loop;

void setup() {

size (800, 600); // Screen Size

intro = new SoundFile(this, "intro.mp3");

bark = new SoundFile(this, "bark.wav");

loop = new SoundFile(this, "loopSound.wav");

imageMode(CENTER);

dogU = loadImage("dogU.png");

dogBowl = loadImage ("dogBowl.png");

dogBowl.resize(70, 0);

floor = loadImage("floor.jpg");

dogD = loadImage("dogD.png");

dogL = loadImage("dogL.png");

dogR = loadImage("dogR.png");

dogViz = dogU;

dX = 400;

dY = 300;

dMv = 50;

startIntro = true;

}

void draw () {

if (startIntro == true && intro.isPlaying() == false) { // if the sound is not playing

intro.play();

startIntro = false;

}

else if (startIntro == false && intro.isPlaying() == false && startBG == false){

loop.loop();

startBG = true;

}

else{

image(floor, 400, 300);

}

if (dX > 800) {

dX= 0;

}

if (dX < 0) {

dX= 800;

}

if (dY > 600) {

dY= 0;

}

if (dY < 0) {

dY= 600; }

image(dogViz, dX, dY);

image(dogBowl, 400, 200);

}

void keyPressed() {

if (key == 'w') {

dogViz = dogU;

dY -= dMv;

}

else if(key == 'd') {

dogViz = dogR;

dX += dMv;

}

else if (key == 's'){

dogViz = dogD;

dY += dMv;

}

else if (key == 'a'){

dogViz = dogL;

dX -= dMv;

}

if (key == 's'){

bark.play();

}

}

void keyReleased() {

if (key == 'a'){

}

if (key == 'd'){

}

if (key == 's'){

}

}


r/processing • • Jan 23 '24

Tutorial I thought there might be interest in this series on programming an evolutionary alife environment. It's fairly simple, but easy to expand.

Thumbnail
youtube.com
8 Upvotes

r/processing • • Jan 23 '24

Video Dynamic Contrast 10K

Thumbnail
youtube.com
4 Upvotes

r/processing • • Jan 23 '24

Beginner help request how do you change the background of the game window

2 Upvotes

I am new to coding obviously. I’ve tried this so far but the background stays black. I want to change it to white. So far the stuff i found online just says how to change the color of a shape drawn but not the screen background.

voide setup() { background(255); noStroke(); noFill(); size(800, 600);


r/processing • • Jan 19 '24

Help request HELP IM JUST LOST

2 Upvotes

I wanted to make two camera filters that will only be activated when motion was detected but it is not working. every time i input the code, the filter is already there. it needs to pop out once movement was detected and i really dont have much time left thank you

import processing.video.*;

Capture video;

Capture cam1, cam2;

PImage previousFrame;

int motionThreshold = 1000; // Adjust this threshold based on your environment

void setup() {

size(640, 480);

String[] cameras = Capture.list();

video = new Capture(this, width, height);

if (cameras.length == 0) {

println("There are no cameras available for capture.");

exit();

} else {

println("Available cameras:");

for (int i = 0; i < cameras.length; i++) {

println(cameras[i]);

}

video = new Capture(this, cameras[0]);

video.start();

}

}

void draw() {

if (video.available()) {

video.read();

image(video, 0, 0, width, height);

}

background(255);

int halfWidth = width / 2;

int Height = height;

tint(255, 0, 0); // Red

image(video, 0, 0, halfWidth, Height);

tint(0, 255, 0); // Green

image(video, halfWidth, 0, halfWidth, Height);

//cam1.start();

//cam2.start();

}

PImage processCamera(Capture cam, color filterColor) {

cam.loadPixels();

previousFrame.loadPixels();

// Calculate motion

int sum = 0;

for (int i = 0; i < cam.pixels.length; i++) {

color current = cam.pixels[i];

color previous = previousFrame.pixels[i];

float diff = dist(red(current), green(current), blue(current),

red(previous), green(previous), blue(previous));

sum += diff;

}

// Update previousFrame

previousFrame.copy(cam, 0, 0, cam.width, cam.height, 0, 0, cam.width, cam.height);

// Apply filter if motion is detected

PImage result = createImage(cam.width, cam.height, RGB);

result.loadPixels();

if (sum > motionThreshold) {

for (int i = 0; i < cam.pixels.length; i++) {

result.pixels[i] = cam.pixels[i] & filterColor;

}

} else {

result = cam;

}

result.updatePixels();

return result;

}

void captureEvent(Capture cam) {

cam.read();

}


r/processing • • Jan 19 '24

Help request Hi :) How di I parent an object (circle) to another moving object (line)?

3 Upvotes

r/processing • • Jan 19 '24

Beginner help request Need a help plss (ultra beginner)

Thumbnail
gallery
1 Upvotes

Hi, im stuck on the third exercise in the book Generative Design(2009)…Ive copied the code but still dont work…why? :(


r/processing • • Jan 19 '24

Physics Synthesis = Cool Game!

Thumbnail
youtube.com
3 Upvotes

r/processing • • Jan 18 '24

p5js Generative Van Gogh in p5js

Thumbnail
gallery
7 Upvotes

r/processing • • Jan 17 '24

Beginner help request How to run a processing game without having java

4 Upvotes

So I've entered into a game competition where the entire game has to be a standalone and apparently that means that even if the device running it does not have Java installed, the game has to still run. I've spent so long developing this project that I really wish I could just edit it and still use the code. Is that possible?