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

Side by Side Diff: cc/animation/keyframed_animation_curve.cc

Issue 2971503002: Transform animations should not collapse by default when interpolating (Closed)
Patch Set: . 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/animation/keyframed_animation_curve.h" 5 #include "cc/animation/keyframed_animation_curve.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 to_return->AddKeyframe(keyframes_[i]->Clone()); 360 to_return->AddKeyframe(keyframes_[i]->Clone());
361 361
362 if (timing_function_) 362 if (timing_function_)
363 to_return->SetTimingFunction(timing_function_->Clone()); 363 to_return->SetTimingFunction(timing_function_->Clone());
364 364
365 to_return->set_scaled_duration(scaled_duration()); 365 to_return->set_scaled_duration(scaled_duration());
366 366
367 return std::move(to_return); 367 return std::move(to_return);
368 } 368 }
369 369
370 gfx::Transform KeyframedTransformAnimationCurve::GetValue( 370 TransformOperations KeyframedTransformAnimationCurve::GetValue(
371 base::TimeDelta t) const { 371 base::TimeDelta t) const {
372 if (t <= TimeUtil::Scale(keyframes_.front()->Time(), scaled_duration())) 372 if (t <= TimeUtil::Scale(keyframes_.front()->Time(), scaled_duration()))
373 return keyframes_.front()->Value().Apply(); 373 return keyframes_.front()->Value();
374 374
375 if (t >= TimeUtil::Scale(keyframes_.back()->Time(), scaled_duration())) 375 if (t >= TimeUtil::Scale(keyframes_.back()->Time(), scaled_duration()))
376 return keyframes_.back()->Value().Apply(); 376 return keyframes_.back()->Value();
377 377
378 t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(), 378 t = TransformedAnimationTime(keyframes_, timing_function_, scaled_duration(),
379 t); 379 t);
380 size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t); 380 size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t);
381 double progress = 381 double progress =
382 TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i); 382 TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i);
383 383
384 return keyframes_[i + 1]->Value().Blend(keyframes_[i]->Value(), progress); 384 return keyframes_[i + 1]->Value().Blend(keyframes_[i]->Value(), progress);
385 } 385 }
386 386
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 t); 564 t);
565 size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t); 565 size_t i = GetActiveKeyframe(keyframes_, scaled_duration(), t);
566 double progress = 566 double progress =
567 TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i); 567 TransformedKeyframeProgress(keyframes_, scaled_duration(), t, i);
568 568
569 return gfx::Tween::SizeValueBetween(progress, keyframes_[i]->Value(), 569 return gfx::Tween::SizeValueBetween(progress, keyframes_[i]->Value(),
570 keyframes_[i + 1]->Value()); 570 keyframes_[i + 1]->Value());
571 } 571 }
572 572
573 } // namespace cc 573 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/keyframed_animation_curve.h ('k') | cc/animation/keyframed_animation_curve_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698