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( lerp(0,255,bounce.getDecay()), lerp(255,0,bounce.getDecay()), 0); 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 mouseMoved(){ bounce.setDecay( norm(mouseX, 50, 150) ); }
getDecay()