Hello Processing folks. I am learning Processing by myself. I am getting fun because I am creating robots. Nevertheless, I feel like overwhelmed because I has not been capable of turning this code from mouse function into command keys functions. I will be content to have such capability to use command keys functions.
loat xVal = 50;
float yVal = 1100;
int myHeadRadius = 300;
int myBodyHeight = 1000;
int myBodyWidth = 500;
int myNeckHeight = 200;
// Our text included this without using it…
float easingVal = 0.1;
void setup() {
size(1200,1200);
ellipseMode(RADIUS); // draw ellipse from top
}
void draw() {
strokeWeight(90);
background(0, 100, 200); // Blue
translate(mouseX, yVal); // Move all to myNewX
// Toggle the scale of everything
if (mousePressed) {
scale(0.6);
} else {
scale(0.4);
}
// Body
noStroke();
fill(255, 204, 0); // Orange
ellipse(0, -99, 99,99); // The leg
fill(0); // Black
// Calculate the rect for the body relative to the 0,0 center
rect(-myBodyWidth/2, -myBodyHeight, myBodyWidth, myBodyHeight-99);
// Neck
// Set the y location of the neck relative to the size of the
// other components
float myNeckY = -1 * (myBodyHeight + myNeckHeight + myHeadRadius);
stroke(255); // White
line(30, -myBodyHeight, 10, myNeckY);
// Hair
pushMatrix(); // Isolate translation and rotation
// translate from the top of the head
translate(44, myNeckY);
// set myAngle to 1/90th of half way around
float myAngle = -PI/444.0;
for (int i = 0; i <= 444; i++) {
// do these statement 99 times, rotating a bit each time
line(444, 0, 0, 0);
rotate(myAngle);
}
popMatrix(); // end isolation of translate and rotate
// Head
noStroke();
// Red head circle
fill(0); // Red
ellipse(12, myNeckY, myHeadRadius, myHeadRadius);
// White eyeball
fill(255); // White
int eyeSize = 200;
ellipse(12, myNeckY-12, eyeSize, eyeSize);
// Green Iris
fill(0, 200, 200); // Green
ellipse(24, myNeckY-9, eyeSize0.66,eyeSize0.66);
// Black pupil
fill(0); // Black
ellipse(20, myNeckY-2, eyeSize0.33,eyeSize0.33);
I want to ask you a big favor. Could you please tell me how to turn this code from mouse function into commandkeys? Do I have to change floats into bolans? I want to be able to build the same robot, but with command keys functions.
Thank you so much.
Sincerely
Steve