From e5f9a9912b053c49ab1fb4ba5f1ae9d419bad85f Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 3 Sep 2020 10:36:20 -0400 Subject: [PATCH] BUG: Fix debug assertion on ShakeCurve animation. Flutter's Curve class requires that the `transform` function map 0 to ~0 and 1 to ~1. The previous ShakeCurve transform function sin(t * 3 * pi).abs(), which doesn't satisfy this property because sin(3 * pi) is 0, not 1. Changing the constant from 3 to 2.5 produces the required endpoint value for t = 1. --- lib/shake_curve.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shake_curve.dart b/lib/shake_curve.dart index 535f773..020fd5d 100644 --- a/lib/shake_curve.dart +++ b/lib/shake_curve.dart @@ -7,6 +7,6 @@ class ShakeCurve extends Curve { @override double transform(double t) { //t from 0.0 to 1.0 - return sin(t * 3 * pi).abs(); + return sin(t * 2.5 * pi).abs(); } }