float xold=-100,yold=-100; float x,y,v0=20; float xmin=0,xmax=50,ymin=0,ymax=50; float xn,yn; void setup() { size(1280,900); background(255); fill(0); stroke(0); } int k=0; float a=0.7; float t=0; void draw(){ background(255); t=0; while (t<=20) { x=xmin; y=v0*sin(a)*t-(10*t*t)/2; x=v0*cos(a)*t; xn=(x-xmin)/(xmax-xmin)*width; yn=height-(y-ymin)/(ymax-ymin)*height; line(xold,yold,xn,yn); xold=xn;yold=yn; t=t+0.01; if (keyPressed) { if (keyCode == UP) { if (v0>0) v0=v0+0.0001; } if (keyCode == DOWN) { if (v0>0) v0=v0-0.0001; } if (keyCode == RIGHT) { if (a>0) a=a-0.000001; } if (keyCode == LEFT) { if (a>0) a=a+0.000001; } } if (key == 'r' || key == 'R'){a=0.7;v0=20;} } textSize(32); fill(200,0,0) text("v0=="+v0,50,350); text("a=="+a,50,420); }