Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                

<div class="trax">
    
<audio class="track" loop preload>
<source src="https://docktv.info/mp3/dot.mp3" type="audio/mpeg" />
</audio>

<div class="player-container">
<div class="play play-pause">
<div class="play-dot"></div>
</div>
</div>

  
<div class="svgcontainer">
 
 <svg class="svgcontain" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 500 500" width="500" height="500">
  
 <circle r="170" class="target1" stroke="#fcfcfc" cx="250" cy="250" />
   
</svg>

 </div>  

  
 <div class="traxno">  
<div style="display:inline; margin-top:1.5vh;">  
<div class="start-time" style="float:left; overflow:hidden;">00:00</div> <div class="end-time" style="float:left; margin-left:.5vw; overflow:hidden;">00:00</div>  
</div>  
</div> 


</div>   



              
            
!

CSS

              
                
body {
  background: black;
  font-family: sans-serif;
  margin: 0;
  padding: 0;
  color: white;
  font-size: 1.5vw;
  line-height: 1.5vw;
  font-weight:300;
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.trax {height:100vh; width:100vw; display:flex; align-items:center; justify-content:center; flex-direction:column;
position:relative;  
float:left;  
border-bottom:1px solid white;}

.play-pause {cursor:pointer;}

.play {
  height:50vh;
  width:50vh; 
  position:relative;
  border-radius: 50%; 
  display:flex; 
  border:white 1px solid;
  align-items:center; 
  justify-content:center;
}

.play-dot {
  position:absolute; 
  top:0;
  height:10vh;
  width:1px;
  background:white;
  z-index:2;  
}

.traxno {
  margin-bottom:3vh;
  display:flex; 
  width:auto;
  margin:1vw;
  flex-direction:column;
  justify-content:center;
  align-items:center; 
  position:fixed;
  bottom:0;
  left:0;
}


.svgcontainer {
  display: flex;
  position: absolute;
  align-items: center;
  justify-content: center;
  float:left;
  width: 100vw;
  height: 100vh;
  z-index:-1;
  
}
.svgcontain {
  width: 100vw;
  height: 100vh;
}


circle {
  fill: none;
  stroke-width: 50px;
}
              
            
!

JS

              
                $(window).on('load', function() {
document.querySelectorAll(".trax").forEach(trax => {  	
  
var track = trax.querySelector(".track");  
var wholelength = track.duration;      
var controlBtn = trax.querySelector(".play-pause"); 
var player = trax.querySelector(".play"); 
var dot = trax.querySelector(".play-dot");
var end = trax.querySelector(".end-time"); 
var start = trax.querySelector(".start-time");   
var container = trax.querySelector(".player-container"); 
var details = trax.querySelector(".traxno");
var target = trax.querySelector(".target1");  


gsap.set(container, {scale:1, opacity:.5}); 
gsap.set(details, {opacity:.5});   

gsap.set("circle", {
  drawSVG: 0,
  rotation: -90,
  transformOrigin: "center center"
});
  
var Tween = gsap.to(player, {
  rotation:360,
  duration:10,
  paused: true, 
  repeat:-1,
  ease:"none",
}); 
  
var Tween2 = gsap.to(target, { 
  paused: true, 
  repeat: -1, 
  duration: wholelength, 
  ease:"none",
  drawSVG: "0% 100%", 
  repeatDelay:.25
})
  
  
function playPause() {
  
    if (track.paused) {
       
       track.play();
      
       Tween.restart(); 
       Tween2.restart(); 
      
        gsap.to(container, {
          opacity:1, 
          duration:.5,
          scale:.9,
          ease:"back.inOut"
        }); 
      
        gsap.to(details, {
          opacity:1, 
          duration:1,
          ease:"back.inOut"
        }); 
      
        gsap.to(player,{
          background:"white",
          duration:.5,
          border:"white 1px solid",
          ease:"power4.out"
        })
      
        gsap.to(dot, {
          opacity:1,
          background:"black",
          duration:.1,
        })
          
      gsap.to(player,{
          duration:1,
          ease:"expo.inOut"
        })
      
       
       
    } else { 

        track.pause();
        track.currentTime = 0
        
        gsap.to(container, {
          opacity:.5, 
          duration:.25,
          scale:1,
          ease:"back.inOut"
        })
     
        gsap.to(details, {
          opacity:.5, 
          duration:1,
          ease:"back.out"
        })
      
        gsap.to(player,{
          background:"none",
          duration:.5,
          border:"white 1px solid",
          ease:"expo.inOut",
        })
      
        gsap.to(player,{
          duration:2,
          ease:"expo.inOut",
          rotate:-0,
        })
             
        gsap.to(dot, {
          background:"white",
          duration:.5,
          ease:"power4.out"
        })
        
    gsap.to(target, { duration:1.5, drawSVG: 0, ease:"expo.inOut" })
      
      Tween.pause();
      Tween2.pause();
  
     
  
    }
}



  function timeCal() {
   
    var length = track.duration;
    var current_time = track.currentTime;

    var totalLength = calculateTotalValue(length);
    $(end).html(totalLength);

    var currentTime = calculateCurrentValue(current_time);
    $(start).html(currentTime);
}

function calculateTotalValue(length) {
  
 
    var minutes = Math.floor(length / 60);
      var  seconds_int = length - minutes * 60;
  if(seconds_int < 10){
    //console.info("here");
    seconds_int = "0"+seconds_int;
    //console.info(seconds_int);
  }
      var seconds_str = seconds_int.toString();
       var  seconds = seconds_str.substr(0, 2);
        var time = minutes + ':' + seconds;
//console.info(seconds_int)
    return time;
}

function calculateCurrentValue(currentTime) {
    var current_hour = parseInt(currentTime / 3600) % 24,
        current_minute = parseInt(currentTime / 60) % 60,

       
        current_seconds_long = currentTime % 60,
        current_seconds = current_seconds_long.toFixed(),


        current_time = (current_minute < 10 ? "0" + current_minute : current_minute) + ":" + (current_seconds < 10 ? "0" + current_seconds : current_seconds) ;
    return current_time;
}  
  
  
controlBtn.addEventListener("click", playPause); track.addEventListener("timeupdate", timeCal); 


});
});






              
            
!
999px

Console