OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ui/views/corewm/window_animations.h" | 5 #include "ui/views/corewm/window_animations.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 gfx::Point(window->bounds().width() * 0.5, | 329 gfx::Point(window->bounds().width() * 0.5, |
330 window->bounds().height() * 0.5), | 330 window->bounds().height() * 0.5), |
331 scale.release())); | 331 scale.release())); |
332 scale_about_pivot->SetReversed(grow); | 332 scale_about_pivot->SetReversed(grow); |
333 scoped_ptr<ui::LayerAnimationElement> transition( | 333 scoped_ptr<ui::LayerAnimationElement> transition( |
334 ui::LayerAnimationElement::CreateInterpolatedTransformElement( | 334 ui::LayerAnimationElement::CreateInterpolatedTransformElement( |
335 scale_about_pivot.release(), | 335 scale_about_pivot.release(), |
336 base::TimeDelta::FromMilliseconds( | 336 base::TimeDelta::FromMilliseconds( |
337 kWindowAnimation_Bounce_DurationMS * | 337 kWindowAnimation_Bounce_DurationMS * |
338 kWindowAnimation_Bounce_GrowShrinkDurationPercent / 100))); | 338 kWindowAnimation_Bounce_GrowShrinkDurationPercent / 100))); |
339 transition->set_tween_type(grow ? ui::Tween::EASE_OUT : ui::Tween::EASE_IN); | 339 transition->set_tween_type(grow ? gfx::Tween::EASE_OUT : gfx::Tween::EASE_IN); |
340 return transition.release(); | 340 return transition.release(); |
341 } | 341 } |
342 | 342 |
343 void AnimateBounce(aura::Window* window) { | 343 void AnimateBounce(aura::Window* window) { |
344 ui::ScopedLayerAnimationSettings scoped_settings( | 344 ui::ScopedLayerAnimationSettings scoped_settings( |
345 window->layer()->GetAnimator()); | 345 window->layer()->GetAnimator()); |
346 scoped_settings.SetPreemptionStrategy( | 346 scoped_settings.SetPreemptionStrategy( |
347 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); | 347 ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); |
348 window->layer()->set_delegate(window); | 348 window->layer()->set_delegate(window); |
349 scoped_ptr<ui::LayerAnimationSequence> sequence( | 349 scoped_ptr<ui::LayerAnimationSequence> sequence( |
(...skipping 23 matching lines...) Expand all Loading... |
373 new HidingWindowAnimationObserver(window); | 373 new HidingWindowAnimationObserver(window); |
374 window->layer()->GetAnimator()->SchedulePauseForProperties( | 374 window->layer()->GetAnimator()->SchedulePauseForProperties( |
375 duration * (100 - kWindowAnimation_Rotate_OpacityDurationPercent) / 100, | 375 duration * (100 - kWindowAnimation_Rotate_OpacityDurationPercent) / 100, |
376 ui::LayerAnimationElement::OPACITY, | 376 ui::LayerAnimationElement::OPACITY, |
377 -1); | 377 -1); |
378 } | 378 } |
379 scoped_ptr<ui::LayerAnimationElement> opacity( | 379 scoped_ptr<ui::LayerAnimationElement> opacity( |
380 ui::LayerAnimationElement::CreateOpacityElement( | 380 ui::LayerAnimationElement::CreateOpacityElement( |
381 show ? kWindowAnimation_ShowOpacity : kWindowAnimation_HideOpacity, | 381 show ? kWindowAnimation_ShowOpacity : kWindowAnimation_HideOpacity, |
382 duration * kWindowAnimation_Rotate_OpacityDurationPercent / 100)); | 382 duration * kWindowAnimation_Rotate_OpacityDurationPercent / 100)); |
383 opacity->set_tween_type(ui::Tween::EASE_IN_OUT); | 383 opacity->set_tween_type(gfx::Tween::EASE_IN_OUT); |
384 window->layer()->GetAnimator()->ScheduleAnimation( | 384 window->layer()->GetAnimator()->ScheduleAnimation( |
385 new ui::LayerAnimationSequence(opacity.release())); | 385 new ui::LayerAnimationSequence(opacity.release())); |
386 | 386 |
387 float xcenter = window->bounds().width() * 0.5; | 387 float xcenter = window->bounds().width() * 0.5; |
388 | 388 |
389 gfx::Transform transform; | 389 gfx::Transform transform; |
390 transform.Translate(xcenter, 0); | 390 transform.Translate(xcenter, 0); |
391 transform.ApplyPerspectiveDepth(kWindowAnimation_Rotate_PerspectiveDepth); | 391 transform.ApplyPerspectiveDepth(kWindowAnimation_Rotate_PerspectiveDepth); |
392 transform.Translate(-xcenter, 0); | 392 transform.Translate(-xcenter, 0); |
393 scoped_ptr<ui::InterpolatedTransform> perspective( | 393 scoped_ptr<ui::InterpolatedTransform> perspective( |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 555 |
556 bool WindowAnimationsDisabled(aura::Window* window) { | 556 bool WindowAnimationsDisabled(aura::Window* window) { |
557 return (window && | 557 return (window && |
558 window->GetProperty(aura::client::kAnimationsDisabledKey)) || | 558 window->GetProperty(aura::client::kAnimationsDisabledKey)) || |
559 CommandLine::ForCurrentProcess()->HasSwitch( | 559 CommandLine::ForCurrentProcess()->HasSwitch( |
560 switches::kWindowAnimationsDisabled); | 560 switches::kWindowAnimationsDisabled); |
561 } | 561 } |
562 | 562 |
563 } // namespace corewm | 563 } // namespace corewm |
564 } // namespace views | 564 } // namespace views |
OLD | NEW |