Help with Changing Overall Color of a Sketch (Filtering)?

edited April 2015 in How To...

I have a code that generates random colors, but I want to apply them to the scene as a whole, not simply the background. Is there any simple way of filtering an entire sketch? Thanks!

Tagged:

Answers

  • What's about drawing rectangle above all other stuff and making it half transparent?

  • _vk_vk
    edited April 2015

    You can make a coy of the screen, use tint() on it, and display it … like:

    void setup(){
        size(400,400);
        }
    
        void draw(){
            background(255);
    
            // draw your stuff
            fill(100,100,220);
            rect(0,0, 300, 200);
    
            fill(0,200,180);
            ellipse(width/2, height/2, frameCount/10, frameCount/10);
    
    
            //make a copy of the screen so far
            //I used the get with 4 parameters to show the result
            // so the effect is happneing only in half screen
            // use get() with no parameters to apply it to full screen... 
            PImage p = get(0, 0, width/2, height);
    
            // do whatever you need to the image
            tint(200,20,20,150);
    
            // display it...
            image(p, 0, 0);
    
            }
    
  • So I inserted _vk's logic into my sketch, but I am trying to tint a screen that contains a .obj, and for some reason the .obj ignores the tint that should be on top of it. Here's a link to the compressed project. Thank you _vk! and Ater, your idea should also work and might be a lot simpler, so I'll give that a shot too.

  • you could try drawing everything inside a PGraphics area and then tinting it. or make a strokeless rectangle that is tinted and highly opac? Im still rather new to processing...

    e.g.

    graphicwindowname.tint(tintvalues);
Sign In or Register to comment.