xxxxxxxxxx
/**
* Archimedes Spiral (v1.0.1) [Java/Pjs]
* Mproc (2017/Nov/15)
* mod GoToLoop
*
* Forum.Processing.org/two/discussion/25020/
* how-to-make-rendering-on-screen-faster#Item_1
*
* OpenProcessing.org/sketch/475427
*/
static final boolean JAVA = 1/2 != 1/2.;
static final String RENDER = JAVA? FX2D : JAVA2D;
static final float FPS = 4*60, BOLD = 1.5;
static final float MAX_PI = 60*PI, STEP = .1;
static final color STROKE = #506496;
float x0, y0;
int cx, cy;
void setup() {
size(500, 400, RENDER);
smooth(3);
frameRate(FPS);
strokeCap(ROUND);
strokeWeight(BOLD);
stroke(STROKE);
background(0);
cx = width>>1;
cy = height>>1;
}
void draw() {
translate(cx, cy);
final float t = STEP * frameCount;
if (t >= MAX_PI) noLoop();
final float x = t*cos(t), y = -t*sin(t);
line(x0, y0, x0 = x, y0 = y);
if (!JAVA) return;
final String s = "Ang: " + nf(t, 3, 2) +
" - FPS: " + nf(frameRate, 3, 2);
surface.setTitle(s);
}