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

Unified Diff: cc/animation/keyframed_animation_curve.h

Issue 2966723003: Add support for bounds animations (Closed)
Patch Set: address reviewer feedback Created 3 years, 5 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/element_animations.cc ('k') | cc/animation/keyframed_animation_curve.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation/keyframed_animation_curve.h
diff --git a/cc/animation/keyframed_animation_curve.h b/cc/animation/keyframed_animation_curve.h
index 1033868a3a1c63053047862fdb409d04a6f1971b..b6b75dd3556756047afbd0d8636390cf99275896 100644
--- a/cc/animation/keyframed_animation_curve.h
+++ b/cc/animation/keyframed_animation_curve.h
@@ -13,6 +13,7 @@
#include "cc/animation/animation_export.h"
#include "cc/animation/timing_function.h"
#include "cc/animation/transform_operations.h"
+#include "ui/gfx/geometry/size_f.h"
namespace cc {
@@ -115,6 +116,26 @@ class CC_ANIMATION_EXPORT FilterKeyframe : public Keyframe {
FilterOperations value_;
};
+class CC_ANIMATION_EXPORT SizeKeyframe : public Keyframe {
+ public:
+ static std::unique_ptr<SizeKeyframe> Create(
+ base::TimeDelta time,
+ const gfx::SizeF& bounds,
+ std::unique_ptr<TimingFunction> timing_function);
+ ~SizeKeyframe() override;
+
+ const gfx::SizeF& Value() const;
+
+ std::unique_ptr<SizeKeyframe> Clone() const;
+
+ private:
+ SizeKeyframe(base::TimeDelta time,
+ const gfx::SizeF& value,
+ std::unique_ptr<TimingFunction> timing_function);
+
+ gfx::SizeF value_;
+};
+
class CC_ANIMATION_EXPORT KeyframedColorAnimationCurve
: public ColorAnimationCurve {
public:
@@ -275,6 +296,42 @@ class CC_ANIMATION_EXPORT KeyframedFilterAnimationCurve
DISALLOW_COPY_AND_ASSIGN(KeyframedFilterAnimationCurve);
};
+class CC_ANIMATION_EXPORT KeyframedSizeAnimationCurve
+ : public SizeAnimationCurve {
+ public:
+ // It is required that the keyframes be sorted by time.
+ static std::unique_ptr<KeyframedSizeAnimationCurve> Create();
+
+ ~KeyframedSizeAnimationCurve() override;
+
+ void AddKeyframe(std::unique_ptr<SizeKeyframe> keyframe);
+ void SetTimingFunction(std::unique_ptr<TimingFunction> timing_function) {
+ timing_function_ = std::move(timing_function);
+ }
+ double scaled_duration() const { return scaled_duration_; }
+ void set_scaled_duration(double scaled_duration) {
+ scaled_duration_ = scaled_duration;
+ }
+
+ // AnimationCurve implementation
+ base::TimeDelta Duration() const override;
+ std::unique_ptr<AnimationCurve> Clone() const override;
+
+ // SizeAnimationCurve implementation
+ gfx::SizeF GetValue(base::TimeDelta t) const override;
+
+ private:
+ KeyframedSizeAnimationCurve();
+
+ // Always sorted in order of increasing time. No two keyframes have the
+ // same time.
+ std::vector<std::unique_ptr<SizeKeyframe>> keyframes_;
+ std::unique_ptr<TimingFunction> timing_function_;
+ double scaled_duration_;
+
+ DISALLOW_COPY_AND_ASSIGN(KeyframedSizeAnimationCurve);
+};
+
} // namespace cc
#endif // CC_ANIMATION_KEYFRAMED_ANIMATION_CURVE_H_
« no previous file with comments | « cc/animation/element_animations.cc ('k') | cc/animation/keyframed_animation_curve.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698