private void FrameCallback(TimeSpan dur) { setState(() => { Offset moveEndVelocityChangeSpeed = Offset.zero; Offset offsetChangeSpeed = Offset.zero; float scaleChangeSpeed = 0; MoveEndVelocity = MoveEndVelocity.DampTo(Offset.zero, ref moveEndVelocityChangeSpeed, 0.3f); aimedOffset += MoveEndVelocity / (1000.0f / (dur - previousTime).Milliseconds); postCheck(); Offset = Offset.DampTo(aimedOffset, ref offsetChangeSpeed, 0.3f); Scale = Mathf.SmoothDamp(Scale, aimedScale, ref scaleChangeSpeed, 0.3f); previousTime = dur; }); WidgetsBinding.instance.scheduleFrameCallback(FrameCallback); }