Getting keyword color up and running

This commit is contained in:
Casey Reas
2012-09-04 03:43:15 +00:00
parent 18843b6f64
commit 954ef88c79
11 changed files with 63 additions and 27 deletions
+3 -2
View File
@@ -55,8 +55,9 @@ void draw() {
strokeWeight(2);
beginShape(POINTS);
for (int a = 0; a < 360; a+=6) {
float x = cx + cos(radians(a)) * secondsRadius;
float y = cy + sin(radians(a)) * secondsRadius;
float angle = radians(a);
float x = cx + cos(angle) * secondsRadius;
float y = cy + sin(angle) * secondsRadius;
vertex(x, y);
}
endShape();
+4 -7
View File
@@ -11,26 +11,23 @@
float x;
float y;
float targetX, targetY;
float easing = 0.05;
void setup()
{
void setup() {
size(640, 360);
noStroke();
}
void draw()
{
void draw() {
background(51);
targetX = mouseX;
float targetX = mouseX;
float dx = targetX - x;
if(abs(dx) > 1) {
x += dx * easing;
}
targetY = mouseY;
float targetY = mouseY;
float dy = targetY - y;
if(abs(dy) > 1) {
y += dy * easing;
@@ -26,11 +26,11 @@ void setup()
{
size(640, 360);
noStroke();
colorMode(RGB, numChars);
colorMode(HSB, numChars);
background(numChars/2);
// Set a gray value for each key
for(int i=0; i<numChars; i++) {
colors[i] = color(i);
for(int i = 0; i < numChars; i++) {
colors[i] = color(i, numChars, numChars);
}
}
@@ -8,6 +8,7 @@
void setup() {
size(640, 360);
noSmooth();
fill(126);
background(102);
}
@@ -14,6 +14,7 @@ int[] bvals;
void setup()
{
size(640, 360);
noSmooth();
xvals = new int[width];
yvals = new int[width];
bvals = new int[width];