13.12.13

Visual Language Week 6

December 12th, 2013

Final Assignment Part 1: I decided to make a color picker. Drawing inspiration from Venn diagrams, RGB values are added together where the squares overlap and color can be manipulated with a slider. 










The code!

import controlP5.*;
ControlP5 cp5;
int sliderValue = 100;
ColorPicker cp;
Slider abc;

float r=255;
float g=0;
float b=0;
float r1=0;
float g1=255;
float b1=0;
float r2=0;
float g2=0;
float b2=255;

void setup(){
  size(600,600);
  cp5 = new ControlP5(this);
    cp = cp5.addColorPicker("R")
          .setPosition(340,540)
          .setColorValue(color(255,128,0,128));  
}

void draw (){
  background(0);
  println (mouseX +"," + mouseY);
  rectMode(CENTER);
  color c = cp.getColorValue();
  r = 255+red(c);
  b = blue(c);
  g = green(c);
  r1 = red(c);
  b1 = 255+blue(c);
  g1 = green(c);
  r2 = red(c);
  b2 = blue(c);
  g2 = 255+green(c);
  //RectA
  fill(r, g, b);
  rect(200,400, 250, 250);
  //RectA1
  fill(r+r1,g+g1, b+b1);
  rect(250, 350, 150, 150);
  //RectB
  fill(r1, g1, b1);
  rect(300, 300, 250, 250);
  //rectb1
  fill(r2+r1,g2+g1, b2+b1);
  rect(350, 250, 150, 150);
  //RectC
  fill(r2, g2, b2);
  rect(400, 200,250, 250);
  //rectC1
  fill(r2+r1+r,g2+g1+g, b2+b1+b);
  rect(300, 300,50, 50);
  //RectA1
  fill(r+r1,g+g1, b+b1);
  rect(250, 350, 150, 150);
  //rectb1
  fill(r2+r1,g2+g1, b2+b1);
  rect(350, 250, 150, 150);
  //rectC1
  fill(r2+r1+r,g2+g1+g, b2+b1+b);
  rect(300, 300,50, 50);

}

Assignment Part 2
Looks like I won't be going into the textile business :(