morphBumpedRect function
The same bump applied to geometry: the rect squashes and kicks around its own center. For consumers whose mass IS the visual (the liquid skin) a transform is not an option.
Implementation
Rect morphBumpedRect(
Rect rect, {
required double value,
required Offset impactAxis,
required double bumpScale,
required double bumpRecoil,
}) {
final ({double scaleX, double scaleY, Offset kick}) bump = morphLandingBump(
value: value,
impactAxis: impactAxis,
bumpScale: bumpScale,
bumpRecoil: bumpRecoil,
);
return .fromCenter(
center: rect.center + bump.kick,
width: rect.width * bump.scaleX,
height: rect.height * bump.scaleY,
);
}