import megamu.shapetween.*; BounceShaper bounce; Tween ball; void setup(){ size(200,200); ball = new Tween(this, 1); ball.setPlayMode( Tween.REPEAT ); bounce = new BounceShaper(); ball.setEasing(bounce); } void draw(){ background(255); for( int i=50; i<150; i++ ) point( i, 50 + bounce.shape( norm(i,50,150) )*100 ); ellipse( 100, lerp(30, 190, ball.position()), 20, 20 ); } void mousePressed(){ bounce.setBounces( (bounce.getBounces()+1) % 8 ); }
setBounces(howMany)