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

background.js 1.5KB

    'use strict'; /** * @ngdoc function * @name domainManagerApp.controller:AboutCtrl * @description * # AboutCtrl * Controller of the domainManagerApp */ angular.module('goApp.background', ['famous.angular']) .controller('BackgroundController',['$scope', '$rootScope', '$famous', '$timeline', function ($scope, $rootScope, $famous, $timeline) { var View = $famous['famous/core/View']; var Modifier = $famous['famous/core/Modifier']; var Surface = $famous['famous/core/Surface']; var Transform = $famous['famous/core/Transform']; var VideoSurface = $famous['famous/surfaces/VideoSurface']; $scope.randomIntFromInterval = function(min,max) { return Math.floor(Math.random()*(max-min+1)+min); } $scope.videos = ['content/videos/bg_1.mov', 'content/videos/bg_2.mov', 'content/videos/bg_1.mov', 'content/videos/bg_2.mov', 'content/videos/bg_3.mov', 'content/videos/bg_4.mov'] $scope.current_video = $scope.videos[$scope.randomIntFromInterval(0,5)] $scope.backgroundView = new View(); var video = new VideoSurface({ size: [undefined, undefined], autoplay: true, src: $scope.current_video, classes: ['bg_video'], properties: { zIndex: 1, } }); video.setAttributes({ loop: '' }); var videoModifier = new Modifier(); videoModifier.transformFrom(function(){ transform: Transform.translate(0, 0, 0) }); $scope.backgroundView.add(videoModifier).add(video); }]);