class Param { static final int SIZE = 10; static final int MIN = 10; static final int MAX = 180; float ang; float off; float x; float y; int col; boolean tweening; float target; Param(int _ang, int _col) { ang = radians(_ang); col = _col; off = MAX; update(); } void update() { x = calcX(off, ang);//centerX + off * cos(ang); y = calcY(off, ang);//centerY + off * sin(ang); } void draw() { if (tweening) { off = lerp(off, target, .2); if (abs(off - target) < 1) { off = target; tweening = false; } update(); } // draw the handle fill(col); ellipse(x, y, SIZE, SIZE); } boolean contains(int _px, int _py) { return (_px > (x-SIZE) && _px < (x+SIZE) && _py > (y-SIZE) && _py < (y+SIZE)); } void tweenTo(float _target) { tweening = true; target = _target; } }