Title: [117951] trunk/Source/WebKit2
Revision
117951
Author
[email protected]
Date
2012-05-22 04:44:54 -0700 (Tue, 22 May 2012)

Log Message

[Qt] Tap-to-zoom overshoot animation
https://bugs.webkit.org/show_bug.cgi?id=87108

Patch by Allan Sandfeld Jensen <[email protected]> on 2012-05-22
Reviewed by Kenneth Rohde Christiansen.

Defines a simple animation curve that combines a large
ease-out (overshoot) with a small ease-in (correction).
Uses that curve for zooming animation.

* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::physicalOvershoot):
(WebKit::QtViewportInteractionEngine::animateItemRectVisible):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (117950 => 117951)


--- trunk/Source/WebKit2/ChangeLog	2012-05-22 11:43:54 UTC (rev 117950)
+++ trunk/Source/WebKit2/ChangeLog	2012-05-22 11:44:54 UTC (rev 117951)
@@ -1,3 +1,18 @@
+2012-05-22  Allan Sandfeld Jensen  <[email protected]>
+
+        [Qt] Tap-to-zoom overshoot animation
+        https://bugs.webkit.org/show_bug.cgi?id=87108
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Defines a simple animation curve that combines a large
+        ease-out (overshoot) with a small ease-in (correction).
+        Uses that curve for zooming animation.
+
+        * UIProcess/qt/QtViewportInteractionEngine.cpp:
+        (WebKit::physicalOvershoot):
+        (WebKit::QtViewportInteractionEngine::animateItemRectVisible):
+
 2012-05-22  Kenneth Rohde Christiansen  <[email protected]>
 
         [Qt] Make the resizing code more straight forward

Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp (117950 => 117951)


--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2012-05-22 11:43:54 UTC (rev 117950)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp	2012-05-22 11:44:54 UTC (rev 117951)
@@ -186,6 +186,12 @@
     m_viewport->setContentPos(newPosition);
 }
 
+// Ease out overshoot of 1.25 combined with ease in correction of 0.25. Both quadratic to have physical motion.
+static qreal physicalOvershoot(qreal t)
+{
+    return (-t * (t - 2)) * 1.25 - (t * t) * 0.25;
+}
+
 bool QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect)
 {
     QRectF currentItemRectVisible = m_viewport->mapRectToWebContent(m_viewport->boundingRect());
@@ -198,9 +204,11 @@
         setItemRectVisible(itemRect);
         return true;
     }
+    QEasingCurve easingCurve;
+    easingCurve.setCustomType(physicalOvershoot);
 
     m_scaleAnimation->setDuration(kScaleAnimationDurationMillis);
-    m_scaleAnimation->setEasingCurve(QEasingCurve::OutCubic);
+    m_scaleAnimation->setEasingCurve(easingCurve);
 
     m_scaleAnimation->setStartValue(currentItemRectVisible);
     m_scaleAnimation->setEndValue(itemRect);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to