implicit-casts:false in flutter/lib/src/physics (#45622)
This commit is contained in:
parent
37f9c54116
commit
5ccd4f3430
@ -48,10 +48,10 @@ class ClampedSimulation extends Simulation {
|
|||||||
final double dxMax;
|
final double dxMax;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
double x(double time) => simulation.x(time).clamp(xMin, xMax);
|
double x(double time) => simulation.x(time).clamp(xMin, xMax) as double;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
double dx(double time) => simulation.dx(time).clamp(dxMin, dxMax);
|
double dx(double time) => simulation.dx(time).clamp(dxMin, dxMax) as double;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool isDone(double time) => simulation.isDone(time);
|
bool isDone(double time) => simulation.isDone(time);
|
||||||
|
@ -65,7 +65,7 @@ class FrictionSimulation extends Simulation {
|
|||||||
// Solving for D given x(time) is trickier. Algebra courtesy of Wolfram Alpha:
|
// Solving for D given x(time) is trickier. Algebra courtesy of Wolfram Alpha:
|
||||||
// x1 = x0 + (v0 * D^((log(v1) - log(v0)) / log(D))) / log(D) - v0 / log(D), find D
|
// x1 = x0 + (v0 * D^((log(v1) - log(v0)) / log(D))) / log(D) - v0 / log(D), find D
|
||||||
static double _dragFor(double startPosition, double endPosition, double startVelocity, double endVelocity) {
|
static double _dragFor(double startPosition, double endPosition, double startVelocity, double endVelocity) {
|
||||||
return math.pow(math.e, (startVelocity - endVelocity) / (startPosition - endPosition));
|
return math.pow(math.e, (startVelocity - endVelocity) / (startPosition - endPosition)) as double;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -116,7 +116,7 @@ class BoundedFrictionSimulation extends FrictionSimulation {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
double x(double time) {
|
double x(double time) {
|
||||||
return super.x(time).clamp(_minX, _maxX);
|
return super.x(time).clamp(_minX, _maxX) as double;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -196,7 +196,7 @@ class _CriticalSolution implements _SpringSolution {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
double dx(double time) {
|
double dx(double time) {
|
||||||
final double power = math.pow(math.e, _r * time);
|
final double power = math.pow(math.e, _r * time) as double;
|
||||||
return _r * (_c1 + _c2 * time) * power + _c2 * power;
|
return _r * (_c1 + _c2 * time) * power + _c2 * power;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,13 +266,13 @@ class _UnderdampedSolution implements _SpringSolution {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
double x(double time) {
|
double x(double time) {
|
||||||
return math.pow(math.e, _r * time) *
|
return (math.pow(math.e, _r * time) as double) *
|
||||||
(_c1 * math.cos(_w * time) + _c2 * math.sin(_w * time));
|
(_c1 * math.cos(_w * time) + _c2 * math.sin(_w * time));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
double dx(double time) {
|
double dx(double time) {
|
||||||
final double power = math.pow(math.e, _r * time);
|
final double power = math.pow(math.e, _r * time) as double;
|
||||||
final double cosine = math.cos(_w * time);
|
final double cosine = math.cos(_w * time);
|
||||||
final double sine = math.sin(_w * time);
|
final double sine = math.sin(_w * time);
|
||||||
return power * (_c2 * _w * cosine - _c1 * _w * sine) +
|
return power * (_c2 * _w * cosine - _c1 * _w * sine) +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user