Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1441)

Unified Diff: cc/animation/timing_function.h

Issue 2775143002: Implement frames() timing function (Closed)
Patch Set: Fix behaviour outside input range [0,1] Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/animation/keyframed_animation_curve_unittest.cc ('k') | cc/animation/timing_function.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/timing_function.h
diff --git a/cc/animation/timing_function.h b/cc/animation/timing_function.h
index 0f475e7624a1a2f82c0c3aed3a4ac8fa1bf090b7..5ff8d3561bd82e3f174d2a1ee7879f309ae77269 100644
--- a/cc/animation/timing_function.h
+++ b/cc/animation/timing_function.h
@@ -19,7 +19,7 @@ class CC_ANIMATION_EXPORT TimingFunction {
virtual ~TimingFunction();
// Note that LINEAR is a nullptr TimingFunction (for now).
- enum class Type { LINEAR, CUBIC_BEZIER, STEPS };
+ enum class Type { LINEAR, CUBIC_BEZIER, STEPS, FRAMES };
virtual Type GetType() const = 0;
virtual float GetValue(double t) const = 0;
@@ -101,6 +101,29 @@ class CC_ANIMATION_EXPORT StepsTimingFunction : public TimingFunction {
DISALLOW_ASSIGN(StepsTimingFunction);
};
+class CC_ANIMATION_EXPORT FramesTimingFunction : public TimingFunction {
+ public:
+ static std::unique_ptr<FramesTimingFunction> Create(int frames);
+ ~FramesTimingFunction() override;
+
+ // TimingFunction implementation.
+ Type GetType() const override;
+ float GetValue(double t) const override;
+ std::unique_ptr<TimingFunction> Clone() const override;
+ void Range(float* min, float* max) const override;
+ float Velocity(double time) const override;
+
+ int frames() const { return frames_; }
+ double GetPreciseValue(double t) const;
+
+ private:
+ explicit FramesTimingFunction(int frames);
+
+ int frames_;
+
+ DISALLOW_ASSIGN(FramesTimingFunction);
+};
+
} // namespace cc
#endif // CC_ANIMATION_TIMING_FUNCTION_H_
« no previous file with comments | « cc/animation/keyframed_animation_curve_unittest.cc ('k') | cc/animation/timing_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698