82 lines
1.9 KiB
Plaintext
82 lines
1.9 KiB
Plaintext
void setup() {
|
|
size(600, 600, P3D);
|
|
background(0);
|
|
|
|
walk1[0] = new PVector(12, robotHeigth, -5);
|
|
walk1[1] = new PVector(12, robotHeigth, 0);
|
|
walk1[2] = new PVector(12, robotHeigth, 5);
|
|
walk1[3] = new PVector(12, robotHeigth-2, 5);
|
|
walk1[4] = new PVector(12, robotHeigth-2, 0);
|
|
walk1[5] = new PVector(12, robotHeigth-2, -5);
|
|
}
|
|
|
|
CustomTimer timerAnimation = new CustomTimer();
|
|
CustomTimer timerXRotation = new CustomTimer();
|
|
CustomTimer timerYRotation = new CustomTimer();
|
|
CustomTimer timerZRotation = new CustomTimer();
|
|
CustomTimer timerScene = new CustomTimer();
|
|
|
|
float counterRotation=0;
|
|
int counterXRotation=0;
|
|
int counterYRotation=0;
|
|
int counterZRotation=0;
|
|
int counterScene=0;
|
|
|
|
float rotationRange = 8;
|
|
|
|
void draw()
|
|
{
|
|
background(0);
|
|
|
|
translate(width/2, height/2, 0);
|
|
|
|
switch(counterScene)
|
|
{
|
|
case 0:
|
|
rotateX(-1*(PI/10));
|
|
rotateY(radians(-210));
|
|
break;
|
|
case 1:
|
|
rotateY(counterRotation);
|
|
break;
|
|
case 2:
|
|
rotateX(radians(-90));
|
|
rotateY(radians(180));
|
|
break;
|
|
default:
|
|
counterScene=0;
|
|
}
|
|
|
|
rotationX = ( counterXRotation%(rotationRange*4) < (rotationRange*2) ? -rotationRange+counterXRotation%(rotationRange*2) : rotationRange+(-1*(counterXRotation%(rotationRange*2))) );
|
|
rotationY = ( counterYRotation%(rotationRange*4) < (rotationRange*2) ? -rotationRange+counterYRotation%(rotationRange*2) : rotationRange+(-1*(counterYRotation%(rotationRange*2))) );
|
|
rotationZ = ( counterZRotation%(rotationRange*4) < (rotationRange*2) ? -rotationRange+counterZRotation%(rotationRange*2) : rotationRange+(-1*(counterZRotation%(rotationRange*2))) );
|
|
|
|
// Animation
|
|
if (timerZRotation.delay(25))
|
|
{
|
|
counterRotation-=0.012f;
|
|
counterZRotation++;
|
|
}
|
|
if (timerXRotation.delay(50))
|
|
{
|
|
counterXRotation++;
|
|
}
|
|
if (timerYRotation.delay(75))
|
|
{
|
|
counterYRotation++;
|
|
}
|
|
if (timerScene.delay(5000))
|
|
{
|
|
counterScene++;
|
|
}
|
|
|
|
scale(6);
|
|
|
|
DrawGround();
|
|
|
|
DrawTestSpots();
|
|
|
|
DrawBody();
|
|
}
|
|
|