(function(b){var a=function(j,q){var g=b.extend({},b.fn.nivoSlider.defaults,q);var m={currentSlide:0,currentImage:"",totalSlides:0,randAnim:"",running:false,paused:false,stop:false};var d=b(j);d.data("nivo:vars",m);d.css("position","relative");d.addClass("nivoSlider");var e=d.children();e.each(function(){var t=b(this);var s="";if(!t.is("img")){if(t.is("a")){t.addClass("nivo-imageLink");s=t}t=t.find("img:first")}var r=t.width();if(r==0){r=t.attr("width")}var i=t.height();if(i==0){i=t.attr("height")}if(r>d.width()){d.width(r)}if(i>d.height()){d.height(i)}if(s!=""){s.css("display","none")}t.css("display","none");m.totalSlides++});if(g.startSlide>0){if(g.startSlide>=m.totalSlides){g.startSlide=m.totalSlides-1}m.currentSlide=g.startSlide}if(b(e[m.currentSlide]).is("img")){m.currentImage=b(e[m.currentSlide])}else{m.currentImage=b(e[m.currentSlide]).find("img:first")}if(b(e[m.currentSlide]).is("a")){b(e[m.currentSlide]).css("display","block")}d.css("background","url("+m.currentImage.attr("src")+") no-repeat");for(var k=0;k<g.slices;k++){var o=Math.round(d.width()/g.slices);if(k==g.slices-1){d.append(b('<div class="nivo-slice"></div>').css({left:(o*k)+"px",width:(d.width()-(o*k))+"px"}))}else{d.append(b('<div class="nivo-slice"></div>').css({left:(o*k)+"px",width:o+"px"}))}}d.append(b('<div class="nivo-caption"><p></p></div>').css({display:"none",opacity:g.captionOpacity}));if(m.currentImage.attr("title")!=""){var n=m.currentImage.attr("title");if(n.substr(0,1)=="#"){n=b(n).html()}b(".nivo-caption p",d).html(n);b(".nivo-caption",d).fadeIn(g.animSpeed)}var c=0;if(!g.manualAdvance&&e.length>1){c=setInterval(function(){p(d,e,g,false)},g.pauseTime)}if(g.directionNav){d.append('<div class="nivo-directionNav"><a class="nivo-prevNav">Prev</a><a class="nivo-nextNav">Next</a></div>');if(g.directionNavHide){b(".nivo-directionNav",d).hide();d.hover(function(){b(".nivo-directionNav",d).show()},function(){b(".nivo-directionNav",d).hide()})}b("a.nivo-prevNav",d).live("click",function(){if(m.running){return false}clearInterval(c);c="";m.currentSlide-=2;p(d,e,g,"prev")});b("a.nivo-nextNav",d).live("click",function(){if(m.running){return false}clearInterval(c);c="";p(d,e,g,"next")})}if(g.controlNav){var l=b('<div class="nivo-controlNav"></div>');d.append(l);for(var k=0;k<e.length;k++){if(g.controlNavThumbs){var f=e.eq(k);if(!f.is("img")){f=f.find("img:first")}if(g.controlNavThumbsFromRel){l.append('<a class="nivo-control" rel="'+k+'"><img src="'+f.attr("rel")+'" alt="" /></a>')}else{l.append('<a class="nivo-control" rel="'+k+'"><img src="'+f.attr("src").replace(g.controlNavThumbsSearch,g.controlNavThumbsReplace)+'" alt="" /></a>')}}else{l.append('<a class="nivo-control" rel="'+k+'">'+(k+1)+"</a>")}}b(".nivo-controlNav a:eq("+m.currentSlide+")",d).addClass("active");b(".nivo-controlNav a",d).live("click",function(){if(m.running){return false}if(b(this).hasClass("active")){return false}clearInterval(c);c="";d.css("background","url("+m.currentImage.attr("src")+") no-repeat");m.currentSlide=b(this).attr("rel")-1;p(d,e,g,"control")})}if(g.keyboardNav){b(window).keypress(function(i){if(i.keyCode=="37"){if(m.running){return false}clearInterval(c);c="";m.currentSlide-=2;p(d,e,g,"prev")}if(i.keyCode=="39"){if(m.running){return false}clearInterval(c);c="";p(d,e,g,"next")}})}if(g.pauseOnHover){d.hover(function(){m.paused=true;clearInterval(c);c=""},function(){m.paused=false;if(c==""&&!g.manualAdvance){c=setInterval(function(){p(d,e,g,false)},g.pauseTime)}})}d.bind("nivo:animFinished",function(){m.running=false;b(e).each(function(){if(b(this).is("a")){b(this).css("display","none")}});if(b(e[m.currentSlide]).is("a")){b(e[m.currentSlide]).css("display","block")}if(c==""&&!m.paused&&!g.manualAdvance){c=setInterval(function(){p(d,e,g,false)},g.pauseTime)}g.afterChange.call(this)});var p=function(r,s,u,x){var y=r.data("nivo:vars");if(y&&(y.currentSlide==y.totalSlides-1)){u.lastSlide.call(this)}if((!y||y.stop)&&!x){return false}u.beforeChange.call(this);if(!x){r.css("background","url("+y.currentImage.attr("src")+") no-repeat")}else{if(x=="prev"){r.css("background","url("+y.currentImage.attr("src")+") no-repeat")}if(x=="next"){r.css("background","url("+y.currentImage.attr("src")+") no-repeat")}}y.currentSlide++;if(y.currentSlide==y.totalSlides){y.currentSlide=0;u.slideshowEnd.call(this)}if(y.currentSlide<0){y.currentSlide=(y.totalSlides-1)}if(b(s[y.currentSlide]).is("img")){y.currentImage=b(s[y.currentSlide])}else{y.currentImage=b(s[y.currentSlide]).find("img:first")}if(u.controlNav){b(".nivo-controlNav a",r).removeClass("active");b(".nivo-controlNav a:eq("+y.currentSlide+")",r).addClass("active")}if(y.currentImage.attr("title")!=""){var z=y.currentImage.attr("title");if(z.substr(0,1)=="#"){z=b(z).html()}if(b(".nivo-caption",r).css("display")=="block"){b(".nivo-caption p",r).fadeOut(u.animSpeed,function(){b(this).html(z);b(this).fadeIn(u.animSpeed)})}else{b(".nivo-caption p",r).html(z)}b(".nivo-caption",r).fadeIn(u.animSpeed)}else{b(".nivo-caption",r).fadeOut(u.animSpeed)}var w=0;b(".nivo-slice",r).each(function(){var i=Math.round(r.width()/u.slices);b(this).css({height:"0px",opacity:"0",background:"url("+y.currentImage.attr("src")+") no-repeat -"+((i+(w*i))-i)+"px 0%"});w++});if(u.effect=="random"){var A=new Array("sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade");y.randAnim=A[Math.floor(Math.random()*(A.length+1))];if(y.randAnim==undefined){y.randAnim="fade"}}if(u.effect.indexOf(",")!=-1){var A=u.effect.split(",");y.randAnim=b.trim(A[Math.floor(Math.random()*A.length)])}y.running=true;if(u.effect=="sliceDown"||u.effect=="sliceDownRight"||y.randAnim=="sliceDownRight"||u.effect=="sliceDownLeft"||y.randAnim=="sliceDownLeft"){var t=0;var w=0;var C=b(".nivo-slice",r);if(u.effect=="sliceDownLeft"||y.randAnim=="sliceDownLeft"){C=b(".nivo-slice",r)._reverse()}C.each(function(){var i=b(this);i.css("top","0px");if(w==u.slices-1){setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed,"",function(){r.trigger("nivo:animFinished")})},(100+t))}else{setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed)},(100+t))}t+=50;w++})}else{if(u.effect=="sliceUp"||u.effect=="sliceUpRight"||y.randAnim=="sliceUpRight"||u.effect=="sliceUpLeft"||y.randAnim=="sliceUpLeft"){var t=0;var w=0;var C=b(".nivo-slice",r);if(u.effect=="sliceUpLeft"||y.randAnim=="sliceUpLeft"){C=b(".nivo-slice",r)._reverse()}C.each(function(){var i=b(this);i.css("bottom","0px");if(w==u.slices-1){setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed,"",function(){r.trigger("nivo:animFinished")})},(100+t))}else{setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed)},(100+t))}t+=50;w++})}else{if(u.effect=="sliceUpDown"||u.effect=="sliceUpDownRight"||y.randAnim=="sliceUpDown"||u.effect=="sliceUpDownLeft"||y.randAnim=="sliceUpDownLeft"){var t=0;var w=0;var B=0;var C=b(".nivo-slice",r);if(u.effect=="sliceUpDownLeft"||y.randAnim=="sliceUpDownLeft"){C=b(".nivo-slice",r)._reverse()}C.each(function(){var i=b(this);if(w==0){i.css("top","0px");w++}else{i.css("bottom","0px");w=0}if(B==u.slices-1){setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed,"",function(){r.trigger("nivo:animFinished")})},(100+t))}else{setTimeout(function(){i.animate({height:"100%",opacity:"1.0"},u.animSpeed)},(100+t))}t+=50;B++})}else{if(u.effect=="fold"||y.randAnim=="fold"){var t=0;var w=0;b(".nivo-slice",r).each(function(){var i=b(this);var v=i.width();i.css({top:"0px",height:"100%",width:"0px"});if(w==u.slices-1){setTimeout(function(){i.animate({width:v,opacity:"1.0"},u.animSpeed,"",function(){r.trigger("nivo:animFinished")})},(100+t))}else{setTimeout(function(){i.animate({width:v,opacity:"1.0"},u.animSpeed)},(100+t))}t+=50;w++})}else{if(u.effect=="fade"||y.randAnim=="fade"){var w=0;b(".nivo-slice",r).each(function(){b(this).css("height","100%");if(w==u.slices-1){b(this).animate({opacity:"1.0"},(u.animSpeed*2),"",function(){r.trigger("nivo:animFinished")})}else{b(this).animate({opacity:"1.0"},(u.animSpeed*2))}w++})}}}}}};var h=function(i){if(this.console&&typeof console.log!="undefined"){console.log(i)}};this.stop=function(){if(!b(j).data("nivo:vars").stop){b(j).data("nivo:vars").stop=true;h("Stop Slider")}};this.start=function(){if(b(j).data("nivo:vars").stop){b(j).data("nivo:vars").stop=false;h("Start Slider")}};g.afterLoad.call(this)};b.fn.nivoSlider=function(c){return this.each(function(){var d=b(this);if(d.data("nivoslider")){return}var e=new a(this,c);d.data("nivoslider",e)})};b.fn.nivoSlider.defaults={effect:"random",slices:15,animSpeed:500,pauseTime:3000,startSlide:0,directionNav:true,directionNavHide:true,controlNav:true,controlNavThumbs:false,controlNavThumbsFromRel:false,controlNavThumbsSearch:".jpg",controlNavThumbsReplace:"_thumb.jpg",keyboardNav:true,pauseOnHover:true,manualAdvance:false,captionOpacity:0.8,beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}};b.fn._reverse=[].reverse})(jQuery);Array.prototype.remove = function(from, to) {if (typeof from != "number") return this.remove(this.indexOf(from));var rest = this.slice((to || from) + 1 || this.length);this.length = from < 0 ? this.length + from : from;return this.push.apply(this, rest);};var d = {onDOMLoad: null,onDOMReady: null,onAudioReady: null, onVideoReady: null, onAjaxStart: null, onAjaxStop: null,DOMLoad: function(){return this.onDOMLoad.getSeconds()+"."+this.onDOMLoad.getMilliseconds();},DOMReady: function() {return this.onDOMReady.getSeconds()+"."+this.onDOMReady.getMilliseconds();},AudioReady: function() {return this.onAudioReady.getSeconds()+"."+this.onAudioReady.getMilliseconds();},VideoReady: function() {return this.onVideoReady.getSeconds()+"."+this.onVideoReady.getMilliseconds();},AjaxStart: function() {return this.onAjaxStart.getSeconds()+"."+this.onAjaxStart.getMilliseconds();},AjaxStop: function() {return this.onAjaxStop.getSeconds()+"."+this.onAjaxStop.getMilliseconds();}};var page = {cur:"home", h:0, pixel_click:false, theStuff:null, leave:false, firstAccess:true};var anim = {possible:false, play:false, startedAt:null }; var sound = {possible:false, player:null, audio:false, ready:true};var base = {startAnimation:null, pageReadyFirstAccess:null, initPage:null, initVideo:null};var titles = { "home" : "Gabriele Fusi - Web and design, webdesigner and developer in Genova, Italy. siti internet applicazioni web","portfolio" : "Gabriele Fusi - Portfolio Web. Web and design, siti internet applicazioni web","design" : "Gabriele Fusi - Portfolio Design. Web and design, siti internet applicazioni web","explore" : "Gabriele Fusi - Explore. Web and design, siti internet applicazioni web","about" : "Gabriele Fusi - Chi sono. Web and design, siti internet applicazioni web","contacts" : "Gabriele Fusi - Contatti. Web and design, siti internet applicazioni web",};function first_access(_page) {page.cur = _page;if(jQuery.browser.msie) {page.firstAccess=false;}else{page.firstAccess=true;}} base.pageReadyFirstAccess = function() {d.onAjaxStart = new Date();var delay = 3873;$(".content").ajaxError(function () {var msg = "Ooooooops. Si &eacute; verificato un errore... questo è imbarazzante! Prova a ricaricare la pagina.";$(".content").html(msg);});if(page.cur == "") page.cur="home";$(".content").animate({opacity:0}, 0, function(){$(this).load("pages/"+page.cur+".php",function(msg) {if(msg != "error") {$(".content").delay(delay).animate({opacity:1}, 400, "easeOutQuart");$.address.title(titles[page.cur]);page.firstAccess=false;init_page();}});});};base.startAnimation = function(){anim.startedAt = new Date();anim.play = true;if(page.firstAccess) {base.pageReadyFirstAccess();d.onVideoReady = new Date();}};function load_page(name) {var _page = name;if(!page.firstAccess) {d.onAjaxStart = new Date();if(page.cur == 'explore'){page.leave = true;}if(_page) page.cur = _page;else page.cur="home";$(".content").ajaxError(function () {var msg = "Ooooooops. Si &eacute; verificato un errore... questo è imbarazzante! Prova a ricaricare la pagina.";$(".content").html(msg);});$(".content").animate({opacity:0}, 100, "easeOutQuart", function(){ $("#loading").css("display","block"); $(this).load("pages/"+page.cur+".php",function(msg) {if(msg != "error") {$(".content").animate({opacity:1}, 200, "easeOutQuart");$.address.title(titles[page.cur]);init_page();}$("#loading").css("display","none");});});}}function init_page() {d.onAjaxStop = new Date();page.pixel_click = false;if(page.cur == "contacts") {contattaci();}else if(page.cur == "design"){Cufon.replace('h1');var store_play;$("head").append('<script src="includes/jquery.colorbox-min.js"></script>');$(".big_img").colorbox({slideshow:true,onOpen: function() {store_play = anim.play;anim.play=false;},onClosed: function() {anim.play=!store_play;$("#anim").click();}});}else if(page.cur == "explore"){$('#tweet').attr('unselectable', 'on');$('#tweet').css('MozUserSelect', 'none');$('#tweet').css('KhtmlUserSelect', 'none');page.pixel_click = true;}else if(page.cur == "portfolio") {Cufon.replace('h1');$('.content li').unbind();$('li div.back').css( { "z-index": 9999} ).animate({opacity: 0}, 1);$('.content li').live("mouseover mouseout", function(event) {if (event.type == 'mouseover') { $(this).find('div.back').stop().animate({opacity: 1}, {duration:100,easing:"jswing"}); }else{$(this).find('div.back').stop().animate({opacity: 0}, {duration:100,easing:"easeOutBounce"}); }});}else if( page.cur == "home"){Cufon.replace('.title');homepage();}else if( page.cur == "about"){Cufon.replace('h1');Cufon.replace('p.first');}$("#wrap").height(60+$(".content").height());}function homepage() {$('#slider').nivoSlider({effect:'sliceDown',slices:15,animSpeed:500,pauseTime:5000,startSlide:0,directionNav:false,directionNavHide:true,controlNav:true,controlNavThumbs:false,controlNavThumbsFromRel:false, controlNavThumbsSearch: '.jpg',controlNavThumbsReplace: '_thumb.jpg',keyboardNav:true, pauseOnHover:true,manualAdvance:false,captionOpacity:0.8,beforeChange: function(){},afterChange: function(){},slideshowEnd: function(){},lastSlide: function(){},afterLoad: function(){}});}function contattaci() { $('#Send').hover( function () {$(".submit_msg").stop().animate({opacity: 1}, {duration:200,easing:"jswing"});}, function() {$(".submit_msg").stop().animate({opacity: 0}, {duration:200,easing:"jswing"});} ); $('#Send').click(function() { var nameVal = $("#name").val();if(nameVal == '') {$("#name_error").remove();$("#name").before('<label class="error" id="name_error">Inserisci il tuo nome.</label>');return false}else{$("#name_error").remove();}var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;var emailaddressVal = $("#email").val(); if(emailaddressVal == '') {$("#email_error").remove();$("#email").before('<label class="error" id="email_error">Inserisci il tuo indirizzo mail</label>');return false}else if(!emailReg.test(emailaddressVal)) {$("#email_error").remove();$("#email").before('<label class="error" id="email_error">Inserisci un indirizzo mail valido.</label>');return false }else{$("#email_error").remove('');}var nameVal = $("#message").val();if(nameVal == '') {$("#message_error").remove();$("#message").before('<label class="error" id="message_error">Inserisci un messaggio!</label>');return false}else{$("#message_error").remove();} $.post("utility/fast_form_contact.php", $("#fast_form").serialize(), function(response){ if(response==1){$("#after_submit").remove();$("#Send").after('<div class="success" id="after_submit">Grazie, ti risponder&oacute; al pi&uacute; presto!</div>');clear_form();}else{$("#after_submit").remove();$("#Send").after('<div class="error" id="after_submit">Ooops! Si &eacute; verificato un errore. Riprova...</div>');}}); return false; });function clear_form() {$("#name").val('');$("#email").val('');$("#message").val(''); }}base.initPage = function(){$(".logo a").hover(function(e){ e.preventDefault(); $(this).animate({opacity:0.6}, 300);},function(e){ e.preventDefault(); $(this).animate({opacity:0.9}, 300);});$("#loading").append("<img src=\"img/g-loader.gif\" width=\"62\" height=\"62\" />").css("display", "none");if(!!document.createElement('audio').canPlayType) {sound.possible=true;anim.possible=true;var player = "";if(!!document.createElement('audio').canPlayType("audio/ogg").match(/maybe|probably/i)) {var player = '<audio>\<source src="audio/hot_stroke-rumble.ogg" type="audio/ogg"></source>\</audio>';}else{var player = '<audio>\<source src="audio/hot_stroke-rumble.mp3" type="audio/mpeg"></source>\</audio>';}jQuery("#audio").append(player);sound.player = jQuery("audio").get(0);sound.player.volume=0.4;jQuery('audio').bind('canplay', function() {d.onAudioReady = new Date();sound.player.play();sound.audio = true;sound.ready = true;base.startAnimation();});$("#play").html("AUDIO OFF");jQuery("#play").click(function() { if(sound.audio) {sound.audio=false;jQuery(this).html("AUDIO ON");sound.player.pause();}else{sound.audio=true;jQuery(this).html("AUDIO OFF");sound.player.play();}});}else{jQuery('#audio').remove();}if(!Modernizr.canvas) {jQuery('#anim').remove();jQuery('#explore_btn').remove();} else {base.initVideo();anim.possible=true;base.startAnimation();jQuery("#anim").click(function() { if(anim.play) {anim.play=false;$(this).html("PIXEL ON");}else{anim.play=true;$(this).html("PIXEL OFF");}}).html("PIXEL OFF");}jQuery.ajax({url: 'utility/explore.json',type:'post',dataType: 'json',success: function (data) {page.theStuff = data;}});if(anim.possible == true && sound.possible == true) {jQuery("#main_control").append("<li style\"font-size:10px;\">Questo sito è sviluppato in HTML5. Il futuro del web!</li>");}else{jQuery("#main_control").append("<li><a href=\"http://www.google.com/chrome/eula.html?hl=it\" style\"font-size:13px; color:#3586C7;\">Aggiorna il tuo browser per visualizzare al meglio il sito!</a></li>");}};base.initVideo = function() { var el = document.getElementById("theapt");var p = Processing(el);var width = window.innerWidth-15;var height = window.innerHeight;components = [];var numParticles = 100;var numParticles_scia = 14;var i;var mx = 0;var my = 0;var impulsX = 0;var impulsY = 0;var impulsToX = 0;var impulsToY = 0;var now;var machine = [3773, 5259, 8260, 10240, 12260, 14260, 16226, 17227, 19226, 22227, 23226, 24226, 27227, 29226];var machineIndex = 0;var events = [];var focusedParticleIndex = null;var pixels = [];for(i = 0; i<numParticles; i++ ) {pixels[i] = {x: Math.random()*width,y: 0,toX: 0,toY: height/2,color: Math.random()*200 + 55,angle: Math.random()*Math.PI*2,size : 0,toSize : Math.random()*4+1,r : 0,g : 0,b: 0,toR: Math.random()*255,toG: Math.random()*255,toB: Math.random()*255,flightMode : 0};pixels[i].toX = pixels[i].x;pixels[i].speedX = 0;pixels[i].speedY = 0; }var currentTransition = 0;var transitions = [function() {for(i = 0; i<pixels.length; i++ ) {var p = pixels[i];if(p.flightMode != 2) {p.toX = Math.random()*width;p.toY = Math.random()*height;p.speedX = Math.cos(p.angle) * Math.random() * 3;p.speedY = Math.sin(p.angle) * Math.random() * 3; p.toR = Math.random()*255;p.toG = Math.random()*255;p.toB = Math.random()*255;}}},function() {for(i = 0; i<pixels.length; i++ ) {var p = pixels[i];if(p.flightMode != 2) {p.r = 255;p.g = 255;p.b = 255;p.size = Math.random()*49 + 50;}}},function() {for(i = 0; i<pixels.length; i++ ) {var p = pixels[i];if(p.flightMode != 2) {p.toSize = Math.random()*10+1;}}},function() {var r = Math.floor(Math.random()*250 + 100);for(i = 0; i<pixels.length; i++ ) {var p = pixels[i];if(p.flightMode != 2) {p.toSize = Math.random()*4+1;p.toX = width/2 + Math.cos(i*3.6*Math.PI/180) * r;p.toY = height/2 + Math.sin(i*3.6*Math.PI/180) * r;impulsX = 0;impulsY = 0;p.speedX = (Math.random() - 0.5)/2;p.speedY = (Math.random() - 0.5)/2; p.toR = Math.random()*255;p.toG = Math.random()*255;p.toB = Math.random()*255;}}},function() {var quad = [[189.85,196.999], [188.246,196.999], [182.547,196.999], [175.85,196.999], [175.246,196.999], [168.547,196.999], [161.246,196.999], [164.438,191.726], [168.547,196.999], [171.738,191.726], [175.51,196.563], [178.438,191.726], [182.547,196.999], [185.738,191.726], [188.947,195.841], [191.438,191.726], [195.547,196.999], [198.738,191.726], [199.007,192.07], [199.007,191.697], [193.734,188.507], [198.572,184.736], [193.734,181.809], [199.007,177.699], [199.007,177.697], [193.734,174.507], [197.85,171.299], [193.734,168.809], [199.007,164.699], [199.007,164.697], [193.734,161.507], [198.572,157.736], [193.734,154.809], [199.007,150.699], [199.007,150.697], [193.734,147.507], [199.007,143.397], [199.007,142.999], [193.734,139.809], [199.007,135.699], [199.007,135.697], [193.734,132.507], [198.572,128.736], [193.734,125.809], [199.007,121.699], [199.007,121.697], [193.734,118.507], [197.85,115.299], [193.734,112.809], [199.007,108.699], [199.007,108.697], [193.734,105.507], [198.572,101.736], [193.734,98.809], [199.007,94.699], [199.007,94.698], [193.734,91.507], [198.858,87.513], [193.734,84.412], [199.007,80.303], [199.007,80.302], [193.734,77.111], [198.572,73.339], [193.734,70.412], [199.007,66.303], [199.007,66.302], [193.734,63.111], [197.85,59.903], [193.734,57.412], [199.007,53.304], [199.007,53.302], [193.734,50.111], [198.572,46.34], [193.733,43.412], [199.007,39.303], [193.733,36.111], [199.007,32], [199.007,31.604], [193.733,28.412], [199.007,24.303], [193.733,21.111], [198.571,17.34], [193.733,14.412], [199.007,10.303], [193.733,7.111], [197.849,3.903], [193.733,1.412], [195.546,0], [193.698,0], [190.507,5.273], [186.736,0.436], [183.809,5.274], [179.698,0], [176.507,5.273], [173.299,1.158], [170.809,5.274], [166.698,0], [163.507,5.273], [159.736,0.436], [156.809,5.274], [152.698,0], [149.507,5.273], [145.396,0], [145,0], [141.809,5.274], [137.698,0], [134.507,5.273], [130.736,0.436], [127.809,5.274], [123.698,0], [120.507,5.273], [117.299,1.158], [114.809,5.274], [110.698,0], [107.507,5.273], [103.736,0.436], [100.809,5.274], [96.698,0], [93.507,5.273], [89.513,0.149], [86.412,5.274], [82.302,0], [79.11,5.273], [75.34,0.436], [72.412,5.274], [68.302,0], [65.11,5.273], [61.903,1.158], [59.412,5.274], [55.302,0], [52.11,5.273], [48.34,0.436], [45.412,5.274], [41.302,0], [38.11,5.273], [34,0], [33.604,0], [30.412,5.274], [26.302,0], [23.11,5.273], [19.34,0.436], [16.412,5.274], [12.302,0], [9.11,5.273], [5.356,0.458], [0.425,4.301], [0.425,4.302], [5.698,7.493], [0.86,11.264], [5.698,14.191], [0.425,18.301], [0.425,18.302], [5.698,21.493], [1.583,24.701], [5.698,27.191], [0.425,31.302], [5.698,34.493], [0.861,38.264], [5.698,41.191], [0.425,45.302], [5.698,48.493], [0.425,52.604], [0.425,53], [5.698,56.191], [0.425,60.302], [5.698,63.493], [0.861,67.264], [5.698,70.191], [0.425,74.302], [5.698,77.493], [1.583,80.701], [5.698,83.191], [0.425,87.302], [5.698,90.493], [0.861,94.264], [5.698,97.191], [0.425,101.302], [5.698,104.493], [0.574,108.487], [5.698,111.588], [0.425,115.698], [5.698,118.89], [0.861,122.66], [5.698,125.588], [0.425,129.698], [5.698,132.89], [1.583,136.098], [5.698,138.588], [0.425,142.698], [5.698,145.89], [0.861,149.66], [5.698,152.588], [0.425,156.698], [5.698,159.89], [0.425,164], [0.425,164.396], [5.698,167.588], [0.425,171.698], [5.698,174.89], [0.861,178.66], [5.698,181.588], [0.425,185.698], [5.698,193.333], [5.673,193.435], [8.113,196.564], [11.041,191.727], [15.151,197], [18.342,191.727], [21.55,195.842], [24.041,191.727], [28.151,197], [31.342,191.727], [35.113,196.564], [38.041,191.727], [42.151,197], [45.342,191.727], [49.453,197], [49.849,197], [53.041,191.727], [57.151,197], [60.342,191.727], [64.113,196.564], [67.041,191.727], [71.151,197], [74.342,191.727], [77.55,195.842], [80.041,191.727], [84.151,197], [87.342,191.727], [91.113,196.564], [94.041,191.727], [98.151,197], [101.342,191.727], [105.337,196.851], [108.438,191.727], [112.547,197], [115.738,191.727], [119.51,196.564], [122.438,191.727], [126.547,197], [129.738,191.727], [132.947,195.842], [135.438,191.727], [139.547,197], [142.738,191.727], [146.51,196.564], [149.438,191.726], [153.547,196.999], [156.738,191.726], [160.85,196.999], [153.547,196.999], [146.85,197], [199.007,197], [199.007,196.999], [195.547,196.999]];var glogo = [[110.25,66], [99.5,62], [87.375,63], [77,67.75], [69.5,78.75], [67.25,87.625], [66,102.75], [66,112.75], [69.25,121], [73,128], [79,134.062], [87.375,136.25], [96.25,136.25], [104.25,136.25], [110.25,132.25], [110.25,120.5], [110.25,113.5], [110.25,108.25], [110.25,100], [106.25,99.125], [99.5,99.125], [133.625,65.5], [131.25,70.75], [135.25,76.25], [132.438,83.5], [133.625,90.75], [133.25,95.75], [133.25,102.5], [133.25,110], [133.625,130], [131.25,132.75], [135.25,134.062], [131.25,137.5], [129.5,134.062], [131.25,130], [135.25,132], [133.625,137.5]];impulsX = 0;impulsY = 0;i=0;while(i<pixels.length-1) {var p = pixels[i];var p2 = pixels[i+1];if(p.flightMode != 2 && p2.flightmode != 2) {p.toX = quad[Math.floor(i*3.6) % quad.length][0]+((width/100)*5);p.toY = quad[Math.floor(i*3.6) % quad.length][1]+((height/100)*15);p2.toX = glogo[i % glogo.length][0]+((width/100)*5);p2.toY = glogo[i % glogo.length][1]+((height/100)*15);p.speedX = 0.2;p.speedY = 0.2; p2.speedX = 0.25;p2.speedY = 0.25; p.toR = 49;p.toG = 133;p.toB = 204;p2.toR = 49;p2.toG = 133;p2.toB = 204;}i += 2;}}];var Universe = function Pixels() {return {framecount : 0,update: function () {impulsX = impulsX + (impulsToX - impulsX) / 30;impulsY = impulsY + (impulsToY - impulsY) / 30;for(i = 0; i<pixels.length; i++ ) {pixels[i].x = pixels[i].x + (pixels[i].toX - pixels[i].x) / 10;pixels[i].y = pixels[i].y + (pixels[i].toY - pixels[i].y) / 10;pixels[i].size = pixels[i].size + (pixels[i].toSize - pixels[i].size) / 10;pixels[i].r = pixels[i].r + (pixels[i].toR - pixels[i].r) / 10;pixels[i].g = pixels[i].g + (pixels[i].toG - pixels[i].g) / 10;pixels[i].b = pixels[i].b + (pixels[i].toB - pixels[i].b) / 10;}for(i = 0; i<pixels.length; i++ ) {var a = Math.abs(pixels[i].toX - mx) *Math.abs(pixels[i].toX - mx);var b = Math.abs(pixels[i].toY - my) *Math.abs(pixels[i].toY - my);var c = Math.sqrt(a+b);if(pixels[i].flightMode != 2) {if(c < 120) {if(pixels[i].flightMode == 0) {var alpha = Math.atan2(pixels[i].y - my, pixels[i].x - mx) * 180 / Math.PI + Math.random()*180-90;pixels[i].degree = alpha;pixels[i].degreeSpeed = Math.random()*1+0.5;pixels[i].frame = 0;}pixels[i].flightMode = 1;} else {pixels[i].flightMode = 0;}}if(pixels[i].flightMode == 0) {pixels[i].toX += pixels[i].speedX;pixels[i].toY += pixels[i].speedY;if(pixels[i].x < 0) {pixels[i].x = width;pixels[i].toX = width;}if(pixels[i].x > width) {pixels[i].x = 0;pixels[i].toX = 0;}if(pixels[i].y < 0) {pixels[i].y = height;pixels[i].toY = height;}if(pixels[i].y > height) {pixels[i].y = 0;pixels[i].toY = 0;}}if(pixels[i].flightMode == 1) {pixels[i].toX = mx + Math.cos((pixels[i].degree + pixels[i].frame ) % 360 * Math.PI /180)*c;pixels[i].toY = my + Math.sin((pixels[i].degree + pixels[i].frame ) % 360 * Math.PI /180)*c;pixels[i].frame += pixels[i].degreeSpeed;pixels[i].degreeSpeed += 0.01;}if(pixels[i].flightMode != 2) {pixels[i].toX += Math.floor(impulsX * pixels[i].size/30);pixels[i].toY += Math.floor(impulsY * pixels[i].size/30);}}var r1 = Math.floor(Math.random() * pixels.length);var r2 = Math.floor(Math.random() * pixels.length);if(pixels[r1].flightMode != 2) pixels[r1].size = Math.random()*30;if(pixels[r2].flightMode != 2 && currentTransition != transitions.length -1) pixels[r2].size = Math.random()*30;this.framecount++;now = new Date();if(now.getTime() - anim.startedAt.getTime() >= machine[machineIndex]) {machineIndex++;impulsX = Math.random()*800-400;impulsY = -Math.random()*400;if(machine[machineIndex] - machine[machineIndex-1] > 3000) {currentTransition = transitions.length-1;}else{currentTransition = Math.floor(Math.random()*(transitions.length-1) );}transitions[currentTransition]();}if(page.leave == true) {if(focusedParticleIndex != null) {pixels[focusedParticleIndex].flightMode = 0;pixels[focusedParticleIndex].toSize = Math.random()*10+1;} page.leave = false;}},draw: function () {for(i = 0; i<pixels.length; i++ ) {p.fill(Math.floor(pixels[i].r), Math.floor(pixels[i].g), Math.floor(pixels[i].b));p.ellipse(pixels[i].x, pixels[i].y, pixels[i].size, pixels[i].size);}if(focusedParticleIndex != null) {p.fill(Math.floor(pixels[focusedParticleIndex].r), Math.floor(pixels[focusedParticleIndex].g), Math.floor(pixels[focusedParticleIndex].b));p.ellipse(pixels[focusedParticleIndex].x, pixels[focusedParticleIndex].y, pixels[focusedParticleIndex].size, pixels[focusedParticleIndex].size);}}}};components.push(new Universe());p.setup = function() {p.size(width, height);p.noStroke();p.frameRate( 60 );};p.mouseMoved = function(){mx = p.mouseX;my = p.mouseY;};p.mousePressed = function() {if(page.pixel_click == true) {if(focusedParticleIndex != null) {pixels[focusedParticleIndex].flightMode = 0;pixels[focusedParticleIndex].toSize = Math.random()*10+1;} for(var i = 0; i<numParticles; i++ ) {if(pixels[i].flightMode == 1) {pixels[i].flightMode = 2;pixels[i].toSize = 100;pixels[i].toX = (width/2) - 480 - 50;pixels[i].toY = 280;focusedParticleIndex = i;var randomStuff = page.theStuff[Math.floor(Math.random()*page.theStuff.length)];jQuery('#tweet').html('<h1>' + randomStuff["text"] + '</h1><strong><a target="_blank" href="http://' + randomStuff.href + '">' + randomStuff.href + '</a></strong>');jQuery('#tweet').show();jQuery('#tweet h1').css('color', 'rgb(' + Math.floor(pixels[i].r) + ',' + Math.floor(pixels[i].g) + ',' + Math.floor(pixels[i].b) + ')');i = numParticles;}}}};p.draw=function(){if(anim.play) {for (var i=0; i<components.length; i++) {components[i].update();}p.background(241, 241, 241);for (var i=0; i<components.length; i++) {components[i].draw();}}};p.init();};
