Example
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com

// Example 1-3: RGB Color
smooth();

background(255);
noStroke();

// Bright red
fill(255,0,0);
ellipse(20,20,16,16);

// Dark red
fill(127,0,0);
ellipse(40,20,16,16);

// Pink (pale red)
fill(255,200,200);
ellipse(60,20,16,16);
  • Terry Rawkins

    But how do I do this within draw()

    ?

  • http://www.learningprocessing.com Daniel Shiffman

    your code would look like:

    void setup() {
      size(200,200);
      smooth();
    }
    
    void draw() {
      background(255);
      noStroke();
    
      // Bright red
      fill(255,0,0);
      ellipse(20,20,16,16);
    
      // Dark red
      fill(127,0,0);
      ellipse(40,20,16,16);
    
      // Pink (pale red)
      fill(255,200,200);
      ellipse(60,20,16,16);
    }
    
  • http://www.rawkins.entadsl.com/game/game-2/index.html Terry Rawkins

    Thanks for that, I can’t reproduce my error but the message was :-

    It looks like you’re mixing “active” and “static” modes.

    I wanted to get more than one colour of text in the draw command and only one colour would show.

    If possible could you explain “active” and “static” modes. I ended up writing a simple sketch without the setup & draw functions saving the output as a jpg file and loading that in to the game.

  • http://www.learningprocessing.com Daniel Shiffman

    static is without setup() and draw(). active is with setup() and draw(). static can only produce a static image since there’s no flow over time (setup() just once, draw() looping over and over)