What is the easiest way to set transparency according to the distance from mouse? I feel dumb for asking this but I can't for the life of my figure out a solution.
I'm working on a "scope" with a crosshair and I'm masking my background and processing drawings with a black rectangle the size of the window and I just need to make a circle around the mouse completely transparent. Thanks!!!!!!!
I'm working on a project in which I have decided to make a mini "sniper" style game. I'm implementing a scope to be used with the right click. At the moment I have an image as the background with processing shapes and such over the background where there will eventually be stick figure people and stuff going on.
My question is in regard to the "flashlight effect". How do I make it work over processing coded shapes and lines. I've used Daniel Shiffman's example for the image with some tweaks and I can get it to work perfectly with the background but I'm stumped as to how to make the rest of the scene show up too. Any help would be greatly appreciated. Thanks.
I'm working on a basic animation with a background that I am making move to the left to create a sense of movement. This is really easy using a variable and subtracting it within draw() such as (x = x - 1). The issue I'm having is making a particle system that I have move in the same way.
I have the particle system called in setup but because setup is only called once using any kind of x = x - 1 equation obviously won't work. I'm unsure as to what I should do. Any help would be appreciated, thanks!
Hello all. I'm very new to processing and this is my first post here.
I have a project to do that requires the use of an image of myself and along with some other image. There needs to be an interactive part of the images and they must include some type of image processing (such as blur or edge detection).
My beginning idea was to have an image of me with the center having the flashlight effect as shown in Daniel Shiffman's example on this site as well as his site. My first issue came up when I was trying to replicate that by using the code directly. I got an array out of bounds exception error and I cant for the life of me find the problem.
Second, I would like to make it so if you clicked in the center portion of the image there would no longer be the flashlight effect but that part would all show up normally. Any tips or help would be greatly appreciated (excuse my commented code or strange errors, I'm struggling with this class having never programmed before.)
Here is what I have so far, and it doesn't work. The error occurs on the line with pixels[loc] = c;
void draw() { loadPixels(); //if(draw_on == false) { for(int x = 0; x < img.width; x++) { for(int y = 0; y < img.height; y++) { int loc = x + y*img.width; r = red(img.pixels[loc]); g = green(img.pixels[loc]); b = blue(img.pixels[loc]); d = dist(x, y, mouseX, mouseY); adjustbrightness = (50-d)/50;
r *= adjustbrightness; g *= adjustbrightness; b *= adjustbrightness;
r = constrain(r, 0, 255); g = constrain(g, 0, 255); b = constrain(b, 0, 255); color c = color(r, g, b); pixels[loc] = c; } } //} updatePixels(); }