LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code

  
  
    
    

CSS
body{
  margin:0;
  height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#318e7d;
  cursor:default;
  -webkit-user-select:none;
  -moz-user-select:none;
  -ms-user-select:none;
}

#meterbox{
  position:relative;
  float:left;
  width:10em;
  height:12em;
  background:#333;
  overflow:hidden;
  border:3px outset #666;
  box-shadow: 0.5em 0.5em 1em rgba(0,0,0,0.2);
}

#meter, #powerbox{
  position:relative;
  width:8em;
  height:5em;
  background:white;
  margin:0.75em;
  border:0.25em inset #ccc;
  overflow:hidden;
}

#rangecircle{
  width:7em;
  height:7em;
  margin:0.5em;
  border-radius:50%;
  overflow:hidden;
}

.gradient{
  background: #00ff00;
  background: -moz-linear-gradient(left, #00ff00 1%, #a5ff00 29%, #f2ff00 49%, #ffe500 71%, #ff3407 100%);
  background: -webkit-linear-gradient(left, #00ff00 1%,#a5ff00 29%,#f2ff00 49%,#ffe500 71%,#ff3407 100%);
  background: linear-gradient(to right, #00ff00 1%,#a5ff00 29%,#f2ff00 49%,#ffe500 71%,#ff3407 100%);
}

#innercircle{
  width:70%;
  height:70%;
  margin:15%;
  border-radius:50%;
  background:white;
  box-shadow:0 0 1em rgba(0,0,0,0.2);
}

#circlemask{
  width:60%;
  top:50%;
  border:4em solid white;
  border-top-color:transparent;
  border-top-width:1em;
  margin:-2.5em;
  margin-top:-4.5em
}

#needle{
  position: absolute;
  width: 0.5em;
  height: 0.5em;
  background: #d00;
  top: 4em;
  left: 50%;
  margin:-0.25em;
  border-radius:50%;
  transform:rotate(-75deg);
  transition:transform 200ms;
}

#needle:after{
  content: "";
  display: block;
  position: relative;
  width: 2px;
  height: 2.5em;
  background: inherit;
  left: 60%;
  margin-left: -2px;
  margin-top: -2.5em;
}

#lightmodule{
  position:relative;
  width:1em;
  height:1em;
  background:#ffa;
  border-radius:50%;
  border:0.25em solid #666;
  left:50%;
  margin-left:-0.75em;
  margin-top:1em;
}

#light{
  width:3em;
  height:3em;
  background: -moz-radial-gradient(center, ellipse cover, rgba(252,252,252,1) 0%, rgba(250,247,227,1) 8%, rgba(239,224,122,0.43) 42%, rgba(239,224,122,0.3) 50%, rgba(239,224,122,0) 72%, rgba(239,224,122,0) 100%);
  background: -webkit-radial-gradient(center, ellipse cover, rgba(252,252,252,1) 0%,rgba(250,247,227,1) 8%,rgba(239,224,122,0.43) 42%,rgba(239,224,122,0.3) 50%,rgba(239,224,122,0) 72%,rgba(239,224,122,0) 100%);
  background: radial-gradient(ellipse at center, rgba(252,252,252,1) 0%,rgba(250,247,227,1) 8%,rgba(239,224,122,0.43) 42%,rgba(239,224,122,0.3) 50%,rgba(239,224,122,0) 72%,rgba(239,224,122,0) 100%);
  opacity:0;
  transition:opacity 200ms;
  z-index:100;
  margin:-1em;
}

#powerbox{
  height:1em;
  position:absolute;
  bottom:0;
}

#gradientbox{
  height:0.3em;
}

#arrow{
  position:absolute;
  width:0;
  border:0.3em solid transparent;
  border-bottom-color:red;
  border-bottom-width:0.5em;
  bottom:0;
  margin-left:-0.3em;
  left:5%;
  transition:left 50ms;
}

#generator{
  position:relative;
  float:left;
  width:5em;
  height:5em;
  background:black;
  border-radius:50%;
  border:3px outset #666;
  box-shadow:inset 0 0 1em 0.5em #333, 0.5em 0.5em 1em rgba(0,0,0,0.2);
  margin-left:6em;
}

#axis{
  position:relative;
  width:3em;
  height:3em;
  top:50%;
  left:50%;
  margin:-1.5em;
  background:#333;
  border-radius:50%;
  border:2px solid #999;
  box-sizing:border-box;
  border-left-color:#666;
  border-right-color:#666;
}

#lever{
  position:relative;
  width:1em;
  height:7em;
  background:#444;
  border:2px solid #666;
  box-sizing:border-box;
  top:50%;
  left:50%;
  margin:-0.5em;
  border-radius:0.5em;
}

#nub{
  position:absolute;
  width:1.5em;
  height:1.5em;
  background:#666;
  bottom:0;
  left:-4px;
  border:2px solid #888;
  border-radius:50%;
  margin:-0.25em;
  cursor:pointer;
}

#fuckupscreen{
  display:none;
  position:absolute;
  width:100%;
  height:100%;
  cursor:wait;
  animation:fade 500ms forwards 1;
  animation-delay:1.5s;
}



/*ON ERROR*/
body[error="true"] #lightmodule{
  background:#faa;
}

body[error="true"] #light{
  background: -moz-radial-gradient(center, ellipse cover, rgba(252,252,252,1) 0%, rgba(253,215,215,1) 8%, rgba(255,56,56,0.43) 42%, rgba(253,79,65,0.3) 50%, rgba(247,143,90,0) 72%, rgba(239,224,122,0) 100%);
  background: -webkit-radial-gradient(center, ellipse cover, rgba(252,252,252,1) 0%,rgba(253,215,215,1) 8%,rgba(255,56,56,0.43) 42%,rgba(253,79,65,0.3) 50%,rgba(247,143,90,0) 72%,rgba(239,224,122,0) 100%);
  background: radial-gradient(ellipse at center, rgba(252,252,252,1) 0%,rgba(253,215,215,1) 8%,rgba(255,56,56,0.43) 42%,rgba(253,79,65,0.3) 50%,rgba(247,143,90,0) 72%,rgba(239,224,122,0) 100%);
  animation:woop 150ms alternate infinite;
}

@keyframes woop{
  from{
    opacity:0;
  }
  to{
    opacity:1;
  }
}

body[error="true"] #needle, body[error="true"] #axis{
  animation:spin 200ms linear infinite;
}

@keyframes spin{
  from{
    transform:rotate(75deg);
  }
  to{
    transform:rotate(440deg);
  }
}

body[error="true"] #arrow{
  animation:coctail 200ms alternate infinite;
}

@keyframes coctail{
  from{
    left:5%;
  }
  to{
    left:95%;
  }
}

@keyframes fade{
  to {
    background:rgba(255,255,255,0.7);
  }
}

body[error="true"] #fuckupscreen{
  display:block;
}
JS
var axisCoords=[],
    rotating=false,
    rotate=0,
    lastAng=0,
    volume=0,
    acc=0,
    error=false;

var nub=document.getElementById("nub"),
    axis=document.getElementById("axis"),
    audio=document.getElementById("audio"),
    needle=document.getElementById("needle"),
    light=document.getElementById("light"),
    arrow=document.getElementById("arrow");

nub.addEventListener("mousedown",grabNub);
nub.addEventListener("touchstart",grabNub);
document.body.addEventListener("mousemove",move);
document.body.addEventListener("touchmove",move);
document.body.addEventListener("mouseup",release);
document.body.addEventListener("touchend",release);
audio.volume=0;

function grabNub(){
  rotating=true;
  var axisBCR=document.getElementById("axis").getBoundingClientRect();
  axisCoords=[axisBCR.left+axisBCR.width/2,axisBCR.top+axisBCR.width/2];
}

function move(evt){
  if (rotating){
    evt.preventDefault();
    evt=evt.touches?evt.touches[0]:evt;
    var ang=Math.atan2(axisCoords[0]-evt.clientX,evt.clientY-axisCoords[1])/Math.PI*180;
    if (ang<0) ang+=360;
    var nextAng=ang-lastAng;
    if (nextAng<0) nextAng+=360;
    if (nextAng>180) nextAng=0;
    axis.style.transform="rotate("+ang+"deg)";
    volume+=nextAng/7;
    lastAng=ang;
    acc=nextAng?Math.min(nextAng/30,1):0;
  }
}

function release(){
  rotating=false;
}

setInterval(function(){
  if (error){
    audio.volume=Math.random();
    return;
  }
  volume*=0.9;
  if (volume>115){
    document.body.setAttribute("error",true);
    error=true;
  }
  var volMap=1.5*volume-75;
  needle.style.transform="rotate("+volMap+"deg)";
  audio.volume=Math.min(volume,100)/100;
  acc-=0.05;
  if (acc<0) acc=0;
  light.style.opacity=acc;
  arrow.style.left=(acc*90+5)+"%";
  if (!rotating){
    axis.style.transform="rotate("+(lastAng+=acc*100)+"deg)";
  }
},50);
Host Instantly Drag and Drop Website Builder

 

Term
Mon, 11/27/2017 - 21:41

Related Codes

Pen ID
Pen ID
Pen ID