Personal portfolio website for Regina Carvalho. Built with Famous.js library.

test.js 1.8KB

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