Skip to content

Instantly share code, notes, and snippets.

@exnihilodub
Last active March 24, 2016 19:37
Show Gist options
  • Select an option

  • Save exnihilodub/addf961369eb37f0b6ed to your computer and use it in GitHub Desktop.

Select an option

Save exnihilodub/addf961369eb37f0b6ed to your computer and use it in GitHub Desktop.
bulk code / notes of DBC first week content. Includes string arrays & making a color palette/
/*int[] ages = {10, 15, 20, 30};
String[] names = {"Ahmet","John","Sarah", "Mahmut"};
*/
/*color myColor = #ffcc00;
color myColor2 = color(255,0,0);
color myColor3 = color(100);*/
color[] palette = {#276025,#224C3B,#213D28,#355643,#42603B};
void setup() {
frameRate(15);
size(800, 600);
/* //println(names[0]+" is "+ages[0]+" years old.");
for (int i = 0; i < names.length; ++i) {
println(names[i]+" is " + ages[i] + " years old." );
}*/
/* if (ages[0] + ages[2] == ages[3]) {
println("yes it's equal");
}
else {
println("no it's not equal");
}
*/
background(0);
noStroke();
}
void draw() {
/* fill(palette[0]);
rect(0, 0, 100, 100);
fill(palette[1]);
rect(0, 100, 100, 100);*/
background(0);
for (int i = 0; i < palette.length; ++i) {
fill(palette[i]);
float randomradi = random(200);
ellipse(width/2, 100+(100*i), randomradi, randomradi);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment