Difference between revisions of "Team:Hong Kong HKU/JS/Nav"

(Update)
(Test new effect)
Line 1: Line 1:
function toggleMenu(a){if(!a)var a=window.event;if(a.stopPropagation(),open=!open){var b=new TimelineLite;b.to(items,.2,{scale:1,ease:Back.easeOut.config(4)},.05);for(var c=0;c<items.length;c++)b.to(items[c],.7,{rotation:c*angle+"deg",ease:Bounce.easeOut},.35);svg.style.pointerEvents="auto"}else{for(var b=new TimelineLite,c=0;c<items.length;c++)b.to(items[c],.3,{rotation:0,ease:Circ.easeOut},.05);b.to(items,.3,{scale:0,ease:Back.easeIn},.3),svg.style.pointerEvents="none"}}var svg=document.getElementById("PlasmidNav"),items=svg.querySelectorAll(".item"),trigger=document.getElementById("Logo"),open=!0,angle=360/7;trigger.addEventListener("click",toggleMenu,!1),svg.onclick=function(a){a.stopPropagation()},document.onclick=function(){open=!1;for(var a=new TimelineLite,b=0;b<items.length;b++)a.to(items[b],.3,{rotation:0,ease:Circ.easeOut},.05);a.to(items,.3,{scale:0,ease:Back.easeIn},.3),svg.style.pointerEvents="none"};
+
function toggleMenu(a){if(!a)var a=window.event;if(a.stopPropagation(),open=!open){var b=new TimelineLite;b.to(items,.2,{scale:1,ease:Back.easeOut.config(4)},.05);for(var c=0;c<items.length;c++)b.to(items[c],.7,{rotation:c*angle+"deg",ease:Bounce.easeOut},.35);svg.style.pointerEvents="auto"}else{for(var b=new TimelineLite,c=0;c<items.length;c++)b.to(items[c],.3,{rotation:0,ease:Circ.easeOut},.05);b.to(items,.3,{scale:0,ease:Back.easeIn},.3),svg.style.pointerEvents="none"}}var svg=document.getElementById("PlasmidNav"),items=svg.querySelectorAll(".item"),trigger=document.getElementById("Logo"),open=!0,angle=360/7;trigger.addEventListener("click",toggleMenu,!1),svg.onclick=function(a){a.stopPropagation()},document.onload=function(){open=!0;var a=new TimelineLite;a.to(items,.2,{scale:1,ease:Back.easeOut.config(4)},.05);for(var b=0;b<items.length;b++)a.to(items[b],.7,{rotation:b*angle+"deg",ease:Bounce.easeOut},.35);svg.style.pointerEvents="auto"};

Revision as of 11:49, 10 October 2016

function toggleMenu(a){if(!a)var a=window.event;if(a.stopPropagation(),open=!open){var b=new TimelineLite;b.to(items,.2,{scale:1,ease:Back.easeOut.config(4)},.05);for(var c=0;c<items.length;c++)b.to(items[c],.7,{rotation:c*angle+"deg",ease:Bounce.easeOut},.35);svg.style.pointerEvents="auto"}else{for(var b=new TimelineLite,c=0;c<items.length;c++)b.to(items[c],.3,{rotation:0,ease:Circ.easeOut},.05);b.to(items,.3,{scale:0,ease:Back.easeIn},.3),svg.style.pointerEvents="none"}}var svg=document.getElementById("PlasmidNav"),items=svg.querySelectorAll(".item"),trigger=document.getElementById("Logo"),open=!0,angle=360/7;trigger.addEventListener("click",toggleMenu,!1),svg.onclick=function(a){a.stopPropagation()},document.onload=function(){open=!0;var a=new TimelineLite;a.to(items,.2,{scale:1,ease:Back.easeOut.config(4)},.05);for(var b=0;b<items.length;b++)a.to(items[b],.7,{rotation:b*angle+"deg",ease:Bounce.easeOut},.35);svg.style.pointerEvents="auto"};