Pen Settings



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


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


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.


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.


                <div id='animation'></div>

	<button id='playMusic' ontouchstart="sketch.playMusic()"  onClick='sketch.playMusic()'>Play Music</button>

<div id='song'>
	<audio crossOrigin='anonymous' src='' id='songPlayer' loop></audio>


                body { margin : 0px !important; font-family : 'IBMPlexSans'}

#playMusic { 
  position : absolute; 
  top : 20px; 
  left : 20px; 
  cursor : pointer; 
  font-size : 20px; 
  -moz-border-radius: 10px;
  -webkit-border-radius: 10px;
  border-radius: 10px;
  -khtml-border-radius: 10px;  
  border : 0px solid #F687B3; 
  color : #fff; 
  background-color: #F687B3; 
  padding : 10px; 


*:focus {
    outline: none;


                var sketch

const s = p => {

    //sketch wide variables can be put here.  useful
    //in the draw function where you may be incrementing
    //or using some fancy trigonometry
    let verticalPosition = 0;

    store = []
    var canvas;
    store.audioStarted = false
    store.beatAlgorithm = "1"
    store.backgroundColor = "#48639B";
    store.fillColor = "#F687B3";
    store.fontColor = "#7F7F7F";
    store.strokeColor = "#ffffff";

    p.playMusic = function() {
      if ( store.audioStarted === false ) {

        //get the audio context of the sketch
        //store.audioContext = sketch.getAudioContext()

        //wire the source of the audio to the hidden 
        //audio element
        //store.source = store.audioContext.createMediaElementSource(document.getElementById('songPlayer'));

        //safari likes to suspend audio, so resume it
       // if (store.audioContext.state === 'suspended') {



        //wire everything end to end, e.g. out the speakers

        //grab our audio and play it
 document.getElementById('songPlayer').loop = false;
        store.audioStarted = true


    p.setup = function() {


        //var canvas = p.createCanvas(250, 250);
        canvas = p.createCanvas(window.innerWidth, window.innerHeight);


    p.draw = function() {


        //draw a line using two points in space
        sketch.line(0, verticalPosition, sketch.width, verticalPosition);

        //modify the height during each draw iteration
        verticalPosition = verticalPosition - 0.5;
        if (verticalPosition < 0) {
            verticalPosition = sketch.height;



sketch = new p5(s);