Enhance the transition with blur filter

The transition works well, But it is a little bit dull. We can slightly enhance the transition by adding subtle changes to the root page. The following GIF indicates the changes.

Slide in with scale

The root page — blue one — stay at the same place. But in order to enhance the depth of layers, that feeling of we temporary put one more screen on top, we scale the page a little bit smaller to make room for the about page.

Not much changes for this effect.

First, we need a scale small and revert animation. (Note that how I am defining a generic animation before defile which element to apply it?)

So we have the following movetoback and movetofront keyframes. The scaling shouldn’t be much because we want to preserve the feeling that the root page is still there. 90% or even 95% scale works fine.

1@-webkit-keyframes movetoback {
2  from {-webkit-transform: scale3d(1.0, 1.0, 1.0);}
3  to { -webkit-transform: scale3d(0.9, 0.9, 1.0);}
4}
5@-webkit-keyframes movetofront {
6    from { -webkit-transform: scale3d(0.9, 0.9, 1.0);}
7    to { -webkit-transform: scale3d(1.0, 1.0, 1.0);}
8}

Next, we apply the keyframes to the .out and .in.reverse.

 1.customslide.out {
 2  -webkit-animation-name: movetoback;
 3  -moz-animation-name: movetoback;
 4  animation-name: movetoback;
 5}
 6.customslide.in.reverse {
 7  -webkit-animation-name: movetofront;
 8  -moz-animation-name: movetofront;
 9  animation-name: movetofront;
10}

What’s more? we can add a blur effect to the root page while it moves to back. It uses the -webkit-filter property with blur function.

1@-webkit-keyframes movetoback {
2    from {-webkit-transform: scale3d(1.0, 1.0, 1.0); -webkit-filter: blur(0);}
3    to { -webkit-transform: scale3d(0.9, 0.9, 1.0); -webkit-filter: blur(15px);}
4}
5@-webkit-keyframes movetofront {
6  from { -webkit-transform: scale3d(0.9, 0.9, 1.0); -webkit-filter: blur(15px);}
7  to { -webkit-transform: scale3d(1.0, 1.0, 1.0); -webkit-filter: blur(0);}
8}

Now you can check the new blur transition result in the following link. There are two versions, with and without the touchstart/end patching, for you to compare the differences on feeling.

Want to check more detail on available filters? Check this CSS filters playground.

What’s next? We’re going to take a look at “Exercises”.

overlaied image when clicked on thumbnail

Makzan | Mobile web app dev with phonegap | Table of Content