Files
pipelines/app/lib/features/chat/workspace/chat_switch_ease.dart
T
alan fd5d4b783c Quick switch: a new request retargets the switch in flight instead of waiting
Peek taps, chords and programmatic activations during a mobile quick
switch start the next switch at once from what is on screen. Swap styles
continue from each card's current rect, pose, opacity and bar reveal;
the tape takes a fresh picture of the frame above the incoming chat and
continues its loop. The incoming chat keeps its speed and brakes once.
The arriving peek takes pointers while it moves; leaving cards do not.
The capture kit's film step gains a taps option for rapid-tap reviews.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 15:20:47 +00:00

21 lines
814 B
Dart

import 'package:flutter/animation.dart';
/// The quick switch's quintic ease. It always brakes to a stop with zero
/// velocity and acceleration. A fresh switch also starts from rest; a switch
/// that retargets one already in flight starts at [launch], the slope that
/// keeps the incoming chat moving at its current speed instead of stalling.
///
/// f(t) = s·t + a·t³ + b·t⁴ + c·t⁵ with f(1) = 1 and f'(1) = f''(1) = 0.
/// Slopes above two would overshoot, so [launch] is clamped to [0, 2].
class ChatSwitchEase extends Curve {
const ChatSwitchEase([this.launch = 0]);
final double launch;
@override
double transformInternal(double t) {
final s = launch.clamp(0.0, 2.0);
final a = 10 - 6 * s, b = 8 * s - 15, c = 6 - 3 * s;
return t * (s + t * t * (a + t * (b + c * t)));
}
}