1( function( $ ) { 2 "use strict"; 3 4 var isWebkit = /Webkit/i.test(navigator.userAgent), 5 isChrome = /Chrome/i.test(navigator.userAgent), 6 isMobile = !!("ontouchstart" in window), 7 isAndroid = /Android/i.test(navigator.userAgent), 8 isIE = document.documentMode; 9 10/*************** 11 Helpers 12 ***************/ 13 14/* Randomly generate an integer between two numbers. */ 15function r(min, max) { 16 return Math.floor(Math.random() * (max - min + 1)) + min; 17} 18 19/* Override the default easing type with something a bit more jazzy. */ 20$.Velocity.defaults.easing = "easeInOutsine"; 21 22/******************* 23 Dot Creation 24 *******************/ 25 26/* Differentiate dot counts based on roughly-guestimated device and browser capabilities. */ 27var dotsCount, 28 dotsHtml = "", 29 $count = $("#count"), 30 $dots; 31 32if (window.location.hash) { 33 dotsCount = window.location.hash.slice(1); 34} else { 35 dotsCount = isMobile ? (isAndroid ? 40 : 60) : (isChrome ? 200 : 175); 36} 37 38for (var i = 0; i < dotsCount; i++) { 39 dotsHtml += "<div class='dot'></div>"; 40} 41 42$dots = $(dotsHtml); 43 44$count.html(dotsCount); 45 46/************* 47 Setup 48 *************/ 49var $container = $("#animated-balls"); 50var screenWidth = $(window).width(), 51 screenHeight = $(window).height(), 52 chromeHeight = screenHeight - (document.documentElement.clientHeight || screenHeight); 53 54var translateZMin = -725, 55translateZMax = 300; 56 57var containerAnimationMap = { 58 perspective: [215, 100], 59 opacity: [0.90, 0.80] 60}; 61 62/* IE10+ produce odd glitching issues when you rotateZ on a parent element subjected to 3D transforms. */ 63if (!isIE) { 64 containerAnimationMap.rotateZ = [5, 0]; 65} 66 67/***************** 68 Animation 69 *****************/ 70 71$container 72 .css("perspective-origin", screenWidth / 2 + "px " + ((screenHeight * 0.45) - chromeHeight) + "px") 73 .velocity(containerAnimationMap, {duration: 800, loop: 1, delay: 3250}); 74 75 76 77 78 79 80/* Animate the dots. */ 81$dots 82 .velocity({ 83 translateX: [ 84 function () { 85 return "+=" + r(-screenWidth / 2.5, screenWidth / 2.5) 86 }, 87 function () { 88 return r(0, screenWidth) 89 } 90 ], 91 translateY: [ 92 function () { 93 return "+=" + r(-screenHeight / 2.75, screenHeight / 2.75) 94 }, 95 function () { 96 return r(0, screenHeight) 97 } 98 ], 99 translateZ: [ 100 function () { 101 return "+=" + r(translateZMin, translateZMax) 102 }, 103 function () { 104 return r(translateZMin, translateZMax) 105 } 106 ], 107 opacity: [ 108 function () { 109 return Math.random() 110 }, 111 function () { 112 return Math.random() + 0.1 113 } 114 ] 115 }, {duration: 6000, loop: true}) 116 .velocity("reverse") 117 .appendTo($container); 118 119 120})( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.