Creating Scroll Animations with Waypoints and Animate.css Last fall Atomic Object launched a redesigned website with lots of great new visuals and content. One of my favorite features of the redesign is the “slide-in reveal” homepage animation that slides images and text in from the sides of the screen as you scroll down the page. Bug 204882 - Add support for scroll behavior relies on ScrollAnimation of the Web process. Scroll-animation-in-web-process-for-review (98.20 KB, patch). Try using animated scroll effects in your next project! It’s a nice way to gently guide users to specific parts of your web page that they’ll surely appreciate 📜 Browser compatibility is solid across the board with the exclusion of Safari, however there's a popular polyfill available that will give you blanket coverage on major browsers.
1 | /* |
---|---|
2 | * Copyright (c) 2011, Google Inc. All rights reserved. |
3 | * Copyright (C) 2015 Apple Inc. All rights reserved. |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are |
7 | * met: |
8 | * |
9 | * * Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. |
11 | * * Redistributions in binary form must reproduce the above |
12 | * copyright notice, this list of conditions and the following disclaimer |
13 | * in the documentation and/or other materials provided with the |
14 | * distribution. |
15 | * * Neither the name of Google Inc. nor the names of its |
16 | * contributors may be used to endorse or promote products derived from |
17 | * this software without specific prior written permission. |
18 | * |
19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
20 | * 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 | */ |
31 | |
32 | #ifndefScrollAnimatorSmooth_h |
33 | #define ScrollAnimatorSmooth_h |
34 | |
35 | #include 'ScrollAnimator.h' |
36 | |
37 | #ifENABLE(SMOOTH_SCROLLING) |
38 | |
39 | namespaceWebCore { |
40 | |
41 | classScrollAnimation; |
42 | |
43 | classScrollAnimatorSmooth final : publicScrollAnimator { |
44 | public: |
45 | explicitScrollAnimatorSmooth(ScrollableArea&); |
46 | virtual~ScrollAnimatorSmooth(); |
47 | |
48 | virtualboolscroll(ScrollbarOrientation, ScrollGranularity, floatstep, floatmultiplier) override; |
49 | virtualvoidscrollToOffsetWithoutAnimation(constFloatPoint&) override; |
50 | |
51 | #if !USE(REQUEST_ANIMATION_FRAME_TIMER) |
52 | virtualvoidcancelAnimations() override; |
53 | virtualvoidserviceScrollAnimations() override; |
54 | #endif |
55 | |
56 | virtualvoidwillEndLiveResize() override; |
57 | virtualvoiddidAddVerticalScrollbar(Scrollbar*) override; |
58 | virtualvoiddidAddHorizontalScrollbar(Scrollbar*) override; |
59 | |
60 | private: |
61 | |
62 | std::unique_ptr<ScrollAnimation> m_animation; |
63 | }; |
64 | |
65 | } // namespace WebCore |
66 | |
67 | #endif // ENABLE(SMOOTH_SCROLLING) |
68 | |
69 | #endif // ScrollAnimatorSmooth_h |
70 |
Animatorsmooth Animations On Scroll Backgrounds
Additionally, the RootFrameViewport never got the animation ticks through the serviceScrollAnimations call in PageAnimator. This patch makes that call the RootFrameViewport's implementation which services the RFV scroll animator then calls through to the FrameView's. BUG=489848 Review URL: https://codereview.chromium.org. Read the latest writing about Custom View Animation. Every day, thousands of voices read, write, and share important stories on Medium about Custom View Animation.