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

Side by Side Diff: cc/input/top_controls_manager.cc

Issue 2032643003: CC Animation: Erase EaseTimingFunction helpers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gmock
Patch Set: Created 4 years, 6 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
« no previous file with comments | « cc/animation/timing_function.cc ('k') | cc/test/animation_test_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/input/top_controls_manager.h" 5 #include "cc/input/top_controls_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 top_controls_animation_ = KeyframedFloatAnimationCurve::Create(); 197 top_controls_animation_ = KeyframedFloatAnimationCurve::Create();
198 base::TimeDelta start_time = base::TimeTicks::Now() - base::TimeTicks(); 198 base::TimeDelta start_time = base::TimeTicks::Now() - base::TimeTicks();
199 top_controls_animation_->AddKeyframe( 199 top_controls_animation_->AddKeyframe(
200 FloatKeyframe::Create(start_time, TopControlsShownRatio(), nullptr)); 200 FloatKeyframe::Create(start_time, TopControlsShownRatio(), nullptr));
201 float max_ending_ratio = (direction == SHOWING_CONTROLS ? 1 : -1); 201 float max_ending_ratio = (direction == SHOWING_CONTROLS ? 1 : -1);
202 top_controls_animation_->AddKeyframe(FloatKeyframe::Create( 202 top_controls_animation_->AddKeyframe(FloatKeyframe::Create(
203 start_time + base::TimeDelta::FromMilliseconds(kShowHideMaxDurationMs), 203 start_time + base::TimeDelta::FromMilliseconds(kShowHideMaxDurationMs),
204 TopControlsShownRatio() + max_ending_ratio, 204 TopControlsShownRatio() + max_ending_ratio,
205 EaseTimingFunction::Create())); 205 CubicBezierTimingFunction::CreatePreset(
206 CubicBezierTimingFunction::EaseType::EASE)));
206 animation_direction_ = direction; 207 animation_direction_ = direction;
207 client_->DidChangeTopControlsPosition(); 208 client_->DidChangeTopControlsPosition();
208 } 209 }
209 210
210 void TopControlsManager::StartAnimationIfNecessary() { 211 void TopControlsManager::StartAnimationIfNecessary() {
211 if (TopControlsShownRatio() == 0.f || TopControlsShownRatio() == 1.f) 212 if (TopControlsShownRatio() == 0.f || TopControlsShownRatio() == 1.f)
212 return; 213 return;
213 214
214 if (TopControlsShownRatio() >= 1.f - top_controls_hide_threshold_) { 215 if (TopControlsShownRatio() >= 1.f - top_controls_hide_threshold_) {
215 // If we're showing so much that the hide threshold won't trigger, show. 216 // If we're showing so much that the hide threshold won't trigger, show.
(...skipping 14 matching lines...) Expand all
230 return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) || 231 return (animation_direction_ == SHOWING_CONTROLS && new_ratio >= 1.f) ||
231 (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f); 232 (animation_direction_ == HIDING_CONTROLS && new_ratio <= 0.f);
232 } 233 }
233 234
234 void TopControlsManager::ResetBaseline() { 235 void TopControlsManager::ResetBaseline() {
235 accumulated_scroll_delta_ = 0.f; 236 accumulated_scroll_delta_ = 0.f;
236 baseline_content_offset_ = ContentTopOffset(); 237 baseline_content_offset_ = ContentTopOffset();
237 } 238 }
238 239
239 } // namespace cc 240 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/timing_function.cc ('k') | cc/test/animation_test_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698