CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 10:31:01 GMT
content-type: text/html
server: cloudflare
last-modified: Thu, 28 Oct 2010 14:02:44 GMT
cf-cache-status: DYNAMIC
vary: Accept-Encoding
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=Mhgw0QJwEQ4LaWeRdqAHaumRzMPJ%2BRnHJCHIbDBmyoe7cmOL01kU8XTK7%2BrWB9hOGG6OcRSeN3bdyrxp%2BIoAf%2Fu8qwyvFL6oWc1Zwaw%3D"}]}
content-encoding: gzip
cf-ray: 98cdaf768d5a3a2b-BOM
alt-svc: h3=":443"; ma=86400
Processing.js
Brightness
by Daniel Shiffman. Adjusts the brightness of part of the image Pixels closer to the mouse will appear brighter.
Original Processing.org Example: Brightness

// All Examples Written by Casey Reas and Ben Fry // unless otherwise stated. PImage img; void setup() { size(200, 200); frameRate(30); img = loadImage("wires.jpg"); } void draw() { loadPixels(); for (int x = 0; x < img.width; x++) { for (int y = 0; y < img.height; y++ ) { // Calculate the 1D location from a 2D grid int loc = x + y*img.width; // Get the R,G,B values from image float r,g,b; r = red (img.pixels[loc]); //g = green (img.pixels[loc]); //b = blue (img.pixels[loc]); // Calculate an amount to change brightness based on proximity to the mouse float maxdist = 50;//dist(0,0,width,height); float d = dist(x,y,mouseX,mouseY); float adjustbrightness = 255*(maxdist-d)/maxdist; r += adjustbrightness; //g += adjustbrightness; //b += adjustbrightness; // Constrain RGB to make sure they are within 0-255 color range r = constrain(r,0,255); //g = constrain(g,0,255); //b = constrain(b,0,255); // Make a new color and set pixel in the window //color c = color(r,g,b); color c = color(r); pixels[loc] = c; } } updatePixels(); }