import megamu.shapetween.*; BackShaper back; Tween punch; void setup(){ size(200,200); punch = new Tween(this, 0.5); punch.setPlayMode( Tween.REVERSE_REPEAT ); back = new BackShaper(); punch.setEasing(back); } void draw(){ background(255); back.setAnticipation( norm(mouseX, 0, width) ); float ant = lerp(75, 150, -back.getAnticipation()); line( ant, 30, ant, 170 ); line( 160, 20, 160, 180 ); ellipse( lerp(75, 150, punch.position()), 100, 20, 20 ); }
getAnticipation()