AngularJS: Wie erstelle ich mit ng-animate & ng-view einen 3D-Würfel-Rotationseffekt?

Ich versuche eine 3D-Würfeleffekt-Animation mit ng-animate und ng-view zu erstellen.

Wenn ich zu einer anderen Seite wechsle, möchte ich das Gefühl haben, dass ich mich auf einem Würfel drehe. Wenn ich auf "Gehe zu Seite 2" klicke, verlässt und dreht sich die aktuelle "Seite 1" nach links und die "Seite 2" kommt von rechts an.

Ich habe etwas in der Nähe, aber mit wirklich schmutzigen CSS-Übergängen und wenn ich die Seiten wechsle, bleiben sie nicht "zusammen".

Codebeispiel:http://jsfiddle.net/bnyJ6/

Ich habe es so versucht:

HTML:

<style ng-bind-html-unsafe="style"></style>

<div class="cube container">
    <div ng-view ng-animate="{enter: 'animate-enter', leave: 'animate-leave'}" ></div>
</div>

<script type="text/ng-template" id="page1.html">
   <div class="container " >
        <div class="masthead">
            <h1 class="muted">PAGE 1</h1>

        <button class="btn display-button" ng-click="direction('front');go('/two')">Go Page 2</button>
        </div>
   </div>
</script>

<script type="text/ng-template" id="page2.html">
   <div class="container " >
        <div class="masthead">
            <h1 class="muted">PAGE 1</h1>
        <button  class="btn display-button" ng-click="direction('back');go('/one')"  >Go page 1</button>
        </div>
   </div>
</script>

Winkel JS:

var app = angular.module('demo', []);

app.config(function ($routeProvider) {
  $routeProvider
  .when('/one', {
    templateUrl:'page1.html'
  })
  .when('/two', {
    templateUrl:'page2.html'
  })
  .otherwise({
    redirectTo:'/one'
  });
});

app.controller('MainCtrl', function($scope, $rootScope, $location) {
  $scope.go = function(path) {
    $location.path(path);
  }
});

CSS3-Dirty- Animation:

.animation{


    -webkit-perspective:2000px;
    -moz-perspective:2000px;
    -o-perspective: 2000px;
    perspective: 2000px;
}

.cube {

    -webkit-transform-style: preserve-3d;
    -moz-transform-style: preserve-3d;
    -o-transform-style: preserve-3d;
    transform-style: preserve-3d;
    position: relative;
}



.animate-enter, 
.animate-leave { 

    -webkit-transition: 3000ms linear all;
    -moz-transition: 3000ms linear all;
    -ms-transition: 3000ms linear all;
    -o-transition: 3000ms linear all;
    transition: 3000ms linear all;
    position: absolute;

}

.animate-enter {
    background-color:green;
    -webkit-transform: rotateY(   90deg ) translateZ(600px ) translateX(585px) ;
    -moz-transform: rotateY(   90deg )  translateZ(600px ) translateX(585px);
    -o-transform: rotateY(   90deg )  translateZ( 600px ) translateX(585px);
    transform: rotateY(   90deg )   translateZ( 600px) translateX(585px);

    opacity: 0;
}

.animate-enter.animate-enter-active{
    background-color:yellow;

    -webkit-transform: rotateY(  0deg ) translateX(250px) translateZ(400px );
    -moz-transform: rotateY(  0deg ) translateX(250px) translateZ(400px );
    -o-transform: rotateY(  0deg )translateX(250px) translateZ(401px );
    transform: rotateY(  0deg )  translateX(250px) translateZ( 400px );
    opacity: 1;
}

.animate-leave {
    background-color:gray;
    -webkit-transform: rotateY(  -90deg ) translateZ( 361px );
    -moz-transform: rotateY(  -90deg ) translateZ( 361px );
    -o-transform: rotateY( -90deg) translateZ( 361px );
    transform: rotateY( -90deg) translateZ( 361px );
    opacity: 0;
}

Haben Sie eine Vorstellung davon, wie Sie diese 3D-Würfel-Effektanimation erhalten?

Vielen Dank für jede Hilfe, die Sie leisten können.

Antworten auf die Frage(2)

Ihre Antwort auf die Frage