Files

81 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

2014-10-06 14:30:00 +02:00
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);
2014-10-06 14:30:00 +02:00
}
CustomTimer timerAnimation = new CustomTimer();
CustomTimer timerXRotation = new CustomTimer();
CustomTimer timerYRotation = new CustomTimer();
CustomTimer timerZRotation = new CustomTimer();
CustomTimer timerScene = new CustomTimer();
2014-10-06 14:30:00 +02:00
float counterRotation=0;
int counterXRotation=0;
int counterYRotation=0;
int counterZRotation=0;
int counterScene=0;
2014-10-06 14:30:00 +02:00
float rotationRange = 8;
2014-10-06 14:30:00 +02:00
void draw()
{
background(0);
translate(width/2, height/2, 0);
switch(counterScene)
2014-10-06 14:30:00 +02:00
{
case 0:
rotateX(-1*(PI/10));
rotateY(radians(-210));
break;
case 1:
rotateY(counterRotation);
2014-10-06 14:30:00 +02:00
break;
case 2:
rotateX(radians(-90));
rotateY(radians(180));
break;
default:
counterScene=0;
2014-10-06 14:30:00 +02:00
}
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))) );
2014-10-06 14:30:00 +02:00
// Animation
if (timerZRotation.delay(25))
2014-10-06 14:30:00 +02:00
{
counterRotation-=0.012f;
counterZRotation++;
2014-10-06 14:30:00 +02:00
}
if (timerXRotation.delay(50))
2014-10-06 14:30:00 +02:00
{
counterXRotation++;
2014-10-06 14:30:00 +02:00
}
if (timerYRotation.delay(75))
2014-10-06 14:30:00 +02:00
{
counterYRotation++;
}
if (timerScene.delay(5000))
{
counterScene++;
2014-10-06 14:30:00 +02:00
}
scale(6);
DrawGround();
2014-10-06 14:30:00 +02:00
DrawTestSpots();
2014-10-06 14:30:00 +02:00
DrawBody();
2014-10-06 14:30:00 +02:00
}