expo-processing/radar.pde

50 lines
1.7 KiB
Plaintext
Executable File

PImage carte;
void setup_radar()
{
carte = loadImage("carte_size.png");
}
void draw_radar()
{
int deltaTime = millis() - int(myTime);
if (deltaTime < 24000)
{
strokeWeight(1);
noFill();
pushMatrix();
translate(width / 2, height / 2);
float angle = (deltaTime % 62831) / 1000.0;
for (int i = 0; i < 600; i++)
{
stroke(0, 255 * (600 - i) / 600.0, 0);
line(0, 0, cos(angle - i / 1000.0) * 300.0, sin(angle - i / 1000.0) * 300.0);
}
stroke(0, 255, 0);
line(0, 0, cos(0) * 300.0, sin(0) * 300.0);
line(0, 0, cos(PI / 6) * 300.0, sin(PI / 6) * 300.0);
line(0, 0, cos(PI / 3) * 300.0, sin(PI / 3) * 300.0);
line(0, 0, cos(PI / 2) * 300.0, sin(PI / 2) * 300.0);
line(0, 0, cos(2 * PI / 3) * 300.0, sin(2 * PI / 3) * 300.0);
line(0, 0, cos(5 * PI / 6) * 300.0, sin(5 * PI / 6) * 300.0);
line(0, 0, cos(PI + 0) * 300.0, sin(PI + 0) * 300.0);
line(0, 0, cos(PI + PI / 6) * 300.0, sin(PI + PI / 6) * 300.0);
line(0, 0, cos(PI + PI / 3) * 300.0, sin(PI + PI / 3) * 300.0);
line(0, 0, cos(PI + PI / 2) * 300.0, sin(PI + PI / 2) * 300.0);
line(0, 0, cos(PI + 2 * PI / 3) * 300.0, sin(PI + 2 * PI / 3) * 300.0);
line(0, 0, cos(PI + 5 * PI / 6) * 300.0, sin(PI + 5 * PI / 6) * 300.0);
circle(0, 0, 600);
circle(0, 0, 500);
circle(0, 0, 400);
circle(0, 0, 300);
circle(0, 0, 200);
circle(0, 0, 100);
popMatrix();
}
else
{
background(255);
image(carte, 130, 0);
}
}