Skip to content

Commit 4628b9f

Browse files
committed
feat(animation): Add right to left animations, and their reverse, for RTL support, closes #643
1 parent ba2a40c commit 4628b9f

File tree

1 file changed

+52
-49
lines changed

1 file changed

+52
-49
lines changed

Diff for: scss/_animations.scss

+52-49
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,14 @@ $slide-in-up-function: cubic-bezier(.1, .7, .1, 1);
272272

273273

274274
/**
275-
* Slide Left-Right
275+
* Slide Left-Right, and Right-Left, each with the reserve
276276
* --------------------------------------------------
277277
* NEW content slides IN from the RIGHT, OLD slides OUT to the LEFT
278278
* Reverse: NEW content slides IN from the LEFT, OLD slides OUT to the RIGHT
279279
*/
280280

281-
.slide-left-right {
281+
.slide-left-right,
282+
.slide-right-left.reverse {
282283
> .ng-enter, &.ng-enter,
283284
> .ng-leave, &.ng-leave {
284285
@include transition(all ease-in-out $transition-duration);
@@ -300,28 +301,29 @@ $slide-in-up-function: cubic-bezier(.1, .7, .1, 1);
300301
/* OLD content ACTIVELY sliding OUT to the LEFT */
301302
@include translate3d(-100%, 0, 0);
302303
}
304+
}
303305

304-
&.reverse {
305-
> .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
306-
@include transition(all ease-in-out $transition-duration);
307-
position: absolute;
308-
top: 0;
309-
right: 0;
310-
bottom: 0;
311-
left: 0;
312-
}
313-
> .ng-enter, &.ng-enter {
314-
/* NEW content placed far LEFT BEFORE it slides IN from the LEFT */
315-
@include translate3d(-100%, 0, 0);
316-
}
317-
> .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
318-
/* NEW content ACTIVELY sliding IN from the LEFT */
319-
@include translate3d(0, 0, 0);
320-
}
321-
> .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
322-
/* OLD content ACTIVELY sliding OUT to the RIGHT */
323-
@include translate3d(100%, 0, 0);
324-
}
306+
.slide-left-right.reverse,
307+
.slide-right-left {
308+
> .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
309+
@include transition(all ease-in-out $transition-duration);
310+
position: absolute;
311+
top: 0;
312+
right: 0;
313+
bottom: 0;
314+
left: 0;
315+
}
316+
> .ng-enter, &.ng-enter {
317+
/* NEW content placed far LEFT BEFORE it slides IN from the LEFT */
318+
@include translate3d(-100%, 0, 0);
319+
}
320+
> .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
321+
/* NEW content ACTIVELY sliding IN from the LEFT */
322+
@include translate3d(0, 0, 0);
323+
}
324+
> .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
325+
/* OLD content ACTIVELY sliding OUT to the RIGHT */
326+
@include translate3d(100%, 0, 0);
325327
}
326328
}
327329

@@ -333,7 +335,8 @@ $slide-in-up-function: cubic-bezier(.1, .7, .1, 1);
333335
$ios7-timing-function: ease-in-out;
334336
$ios7-transition-duration: 250ms;
335337

336-
.slide-left-right-ios7 {
338+
.slide-left-right-ios7,
339+
.slide-right-left-ios7.reverse {
337340
> .ng-enter, &.ng-enter,
338341
> .ng-leave, &.ng-leave {
339342
@include transition(all $ios7-timing-function $ios7-transition-duration);
@@ -358,31 +361,31 @@ $ios7-transition-duration: 250ms;
358361
/* OLD content ACTIVELY sliding OUT to the LEFT */
359362
@include translate3d(-15%, 0, 0);
360363
}
361-
362-
&.reverse {
363-
> .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
364-
@include transition(all $ios7-timing-function $ios7-transition-duration);
365-
position: absolute;
366-
top: 0;
367-
right: -1px;
368-
bottom: 0;
369-
left: -1px;
370-
width: auto;
371-
border-right: 1px solid #ddd;
372-
border-left: 1px solid #ddd;
373-
}
374-
> .ng-enter, &.ng-enter {
375-
/* NEW content placed far LEFT BEFORE it slides IN from the LEFT */
376-
@include translate3d(-100%, 0, 0);
377-
}
378-
> .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
379-
/* NEW content ACTIVELY sliding IN from the LEFT */
380-
@include translate3d(0, 0, 0);
381-
}
382-
> .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
383-
/* OLD content ACTIVELY sliding OUT to the RIGHT */
384-
@include translate3d(15%, 0, 0);
385-
}
364+
}
365+
.slide-left-right-ios7.reverse,
366+
.slide-right-left-ios7 {
367+
> .ng-enter, &.ng-enter, > .ng-leave, &.ng-leave {
368+
@include transition(all $ios7-timing-function $ios7-transition-duration);
369+
position: absolute;
370+
top: 0;
371+
right: -1px;
372+
bottom: 0;
373+
left: -1px;
374+
width: auto;
375+
border-right: 1px solid #ddd;
376+
border-left: 1px solid #ddd;
377+
}
378+
> .ng-enter, &.ng-enter {
379+
/* NEW content placed far LEFT BEFORE it slides IN from the LEFT */
380+
@include translate3d(-100%, 0, 0);
381+
}
382+
> .ng-enter.ng-enter-active, &.ng-enter.ng-enter-active {
383+
/* NEW content ACTIVELY sliding IN from the LEFT */
384+
@include translate3d(0, 0, 0);
385+
}
386+
> .ng-leave.ng-leave-active, &.ng-leave.ng-leave-active {
387+
/* OLD content ACTIVELY sliding OUT to the RIGHT */
388+
@include translate3d(15%, 0, 0);
386389
}
387390
}
388391

0 commit comments

Comments
 (0)