James Peret's personal portfolio website version 2. Built with Famous.js and AngularJS.

test.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. 'use strict';
  2. /**
  3. * @ngdoc function
  4. * @name domainManagerApp.controller:AboutCtrl
  5. * @description
  6. * # AboutCtrl
  7. * Controller of the domainManagerApp
  8. */
  9. angular.module('goApp.test', ['ngFx', 'ngAnimate', 'goApp.data'])
  10. .controller('TestController',['$scope', '$rootScope', '$famous', '$timeline', '$location', '$route', '$timeout', 'Data', function ($scope, $rootScope, $famous, $timeline, $location, $route, $timeout, Data) {
  11. var link = $location.url()
  12. $scope.pageData = Data.getPageData(link);
  13. $rootScope.$on('data:loaded', function(data) {
  14. if(!$scope.$$phase) {
  15. $scope.$apply(function(){
  16. $scope.pageData = Data.getPageData(link);
  17. });
  18. }
  19. });
  20. // FadeIn
  21. $timeout(function(){
  22. $scope.showView = true;
  23. },100);
  24. $scope.fadeOut = function() {
  25. $scope.showView = false;
  26. $timeout(function(){
  27. $location.path("/");
  28. },500);
  29. }
  30. // Moving Cube
  31. var Transitionable = $famous['famous/transitions/Transitionable'];
  32. var Easing = $famous['famous/transitions/Easing'];
  33. $scope.t = new Transitionable(0);
  34. $scope.translation = $timeline([
  35. [0, [500, 400, 100], Easing.inOutQuad],
  36. [0.25, [400, 200, 100], Easing.inOutQuad],
  37. [0.5, [300, 300, 100], Easing.inOutQuad],
  38. [0.75, [200, 500, 100], Easing.inOutQuad],
  39. [1, [100, 100, 100], Easing.inOutQuad],
  40. ]);
  41. $scope.startAnimations = function(){
  42. $scope.t.delay((1000), function(){ // we will delay each animation based on index
  43. $scope.t.set(1, {duration: 3400}, function(){
  44. // Animation Completion Callback
  45. });
  46. });
  47. }
  48. //$scope.startAnimations();
  49. $scope.pageData = Data.getPageData();
  50. $scope.startAnimations();
  51. }]);