mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Getting keyword color up and running
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user