Push animation is way better now.

This commit is contained in:
connors 2013-09-14 17:36:10 -07:00
Родитель 5b9d94e88d
Коммит d90773ece9
4 изменённых файлов: 51 добавлений и 21 удалений

30
dist/ratchet.css поставляемый
Просмотреть файл

@ -954,22 +954,38 @@ button.button-block {
opacity: 1;
}
.content.slide {
z-index: 2;
-webkit-transition-timing-function: cubic-bezier(0.1, 0.7, 0.1, 1);
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-transition: -webkit-transform .3s;
transition: transform .3s;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
z-index: 2;
-webkit-transition: -webkit-transform 400ms;
transition: transform 400ms;
}
.content.slide.sliding-in.top, .content.slide.right:not([class*="sliding-in"]) {
-webkit-animation-name: fadeOverlay;
animation-name: fadeOverlay;
-webkit-animation-duration: 400ms;
}
.content.slide.right:not([class*="sliding-in"]) {
-webkit-animation-direction: reverse;
}
.content.slide.left {
z-index: 1;
box-shadow: none;
-webkit-transform: translate3d(-60%, 0, 0);
transform: translate3d(-60%, 0, 0);
-webkit-transform: translate3d(-20%, 0, 0);
transform: translate3d(-20%, 0, 0);
}
.content.slide.right {
z-index: 3;
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
}
@-webkit-keyframes fadeOverlay {
from {
box-shadow: 0 0 10px rgba(0, 0, 0, 0), -320px 0 0 rgba(0, 0, 0, 0);
}
to {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3), -320px 0 0 rgba(0, 0, 0, 0.1);
}
}

6
dist/ratchet.js поставляемый
Просмотреть файл

@ -320,8 +320,8 @@
}
if (/slide/.test(transition)) {
swap.classList.add(enter ? 'right' : 'left');
swap.classList.add('slide');
swap.classList.add('sliding-in', enter ? 'right' : 'left');
swap.classList.add('slide', enter ? 'top' : 'bottom');
container.classList.add('slide');
}
@ -359,7 +359,7 @@
function slideEnd() {
swap.removeEventListener('webkitTransitionEnd', slideEnd);
swap.classList.remove('slide');
swap.classList.remove('slide', 'bottom', 'top', 'sliding-in');
swap.classList.remove(swapDirection);
container.parentNode.removeChild(container);
complete && complete();

Просмотреть файл

@ -286,8 +286,8 @@
}
if (/slide/.test(transition)) {
swap.classList.add(enter ? 'right' : 'left');
swap.classList.add('slide');
swap.classList.add('sliding-in', enter ? 'right' : 'left');
swap.classList.add('slide', enter ? 'top' : 'bottom');
container.classList.add('slide');
}
@ -325,7 +325,7 @@
function slideEnd() {
swap.removeEventListener('webkitTransitionEnd', slideEnd);
swap.classList.remove('slide');
swap.classList.remove('slide', 'bottom', 'top', 'sliding-in');
swap.classList.remove(swapDirection);
container.parentNode.removeChild(container);
complete && complete();

Просмотреть файл

@ -18,19 +18,28 @@
// Slide animation iOS7
&.slide {
-webkit-transition-timing-function: cubic-bezier(.1, .7, .1, 1); //Thanks to @c2prods
z-index: 2;
-webkit-transition-timing-function: cubic-bezier(.1, .7, .1, 1); // Inspired by @c2prods
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-transition: -webkit-transform .3s;
transition: transform .3s;
box-shadow: 0 0 10px rgba(0,0,0,.5);
z-index: 2;
-webkit-transition: -webkit-transform 400ms;
transition: transform 400ms;
&.sliding-in.top,
&.right:not([class*="sliding-in"]) {
-webkit-animation-name: fadeOverlay;
animation-name: fadeOverlay;
-webkit-animation-duration: 400ms;
}
&.right:not([class*="sliding-in"]) {
-webkit-animation-direction: reverse;
}
&.left {
z-index: 1;
box-shadow: none;
-webkit-transform: translate3d(-60%, 0, 0); // Creates the parallax effect
transform: translate3d(-60%, 0, 0);
-webkit-transform: translate3d(-20%, 0, 0); // Creates the parallax effect
transform: translate3d(-20%, 0, 0);
}
&.right {
@ -39,4 +48,9 @@
transform: translate3d(100%, 0, 0);
}
}
}
@-webkit-keyframes fadeOverlay {
from { box-shadow: 0 0 10px rgba(0,0,0,0), -320px 0 0 rgba(0,0,0,0); }
to { box-shadow: 0 0 10px rgba(0,0,0,.3), -320px 0 0 rgba(0,0,0,.1); }
}