nc-photos/app/lib/animation_util.dart

19 lines
325 B
Dart
Raw Normal View History

2024-05-25 09:51:42 +02:00
double tremblingTransform(int count, double t) {
final tt = (t * count) % 1;
return _tremblingTransformT(tt);
}
double _tremblingTransformT(double t) {
if (t <= 0 || t >= 1) {
return 0;
}
final x = 4 * t;
if (x < 1) {
return -x;
} else if (x < 3) {
return x - 1;
} else {
return 4 - x;
}
}