From 30a8e04b7ee3fade11f7ec0f1a23c8006ca15b6d Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Thu, 1 Oct 2015 09:03:19 -0700 Subject: [PATCH] Added missing clamped_simulation.dart file --- packages/flutter/lib/animation.dart | 1 + .../lib/src/animation/clamped_simulation.dart | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 packages/flutter/lib/src/animation/clamped_simulation.dart diff --git a/packages/flutter/lib/animation.dart b/packages/flutter/lib/animation.dart index 4c449e2d97..f35b2538bb 100644 --- a/packages/flutter/lib/animation.dart +++ b/packages/flutter/lib/animation.dart @@ -10,6 +10,7 @@ library animation; export 'src/animation/animated_simulation.dart'; export 'src/animation/animated_value.dart'; export 'src/animation/animation_performance.dart'; +export 'src/animation/clamped_simulation.dart'; export 'src/animation/curves.dart'; export 'src/animation/forces.dart'; export 'src/animation/scheduler.dart'; diff --git a/packages/flutter/lib/src/animation/clamped_simulation.dart b/packages/flutter/lib/src/animation/clamped_simulation.dart new file mode 100644 index 0000000000..d3d14c7dd2 --- /dev/null +++ b/packages/flutter/lib/src/animation/clamped_simulation.dart @@ -0,0 +1,28 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:newton/newton.dart'; + +class ClampedSimulation extends Simulation { + ClampedSimulation(this.simulation, { + this.xMin: double.NEGATIVE_INFINITY, + this.xMax: double.INFINITY, + this.dxMin: double.NEGATIVE_INFINITY, + this.dxMax: double.INFINITY + }) { + assert(simulation != null); + assert(xMax >= xMin); + assert(dxMax >= dxMin); + } + + final Simulation simulation; + final double xMin; + final double xMax; + final double dxMin; + final double dxMax; + + double x(double time) => simulation.x(time).clamp(xMin, xMax); + double dx(double time) => simulation.dx(time).clamp(dxMin, dxMax); + bool isDone(double time) => simulation.isDone(time); +}