cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              body{
  margin:0;
  padding: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

            
          
!
            
              var mySprite;
var midground;
var bgmask;
var showBackgroundMask = true;

SPF.set({

  at: 'back', // You can use 'back', 'mid' and 'fore'


  init: function(PIXI, input) {
    
    //sprite that puts patterns in the background
    mySprite = new PIXI.Sprite(input.patterns.botanicorganic4, 1, 1);
    
    //setting the anchor of the patter to its center
    mySprite.anchor.set(0.5,0.5);
    
    //setting the height and the width
    mySprite.x = input.width / 2;
    mySprite.y = input.height / 2;
    
    //adding it to a container, so it shows in the video
    input.container.addChild(mySprite);
    
    
    //maske på bagrunden, replace with moving graphics
    /*var circle = new PIXI.Graphics();
    circle.beginFill(0xFFFFFF);
    circle.drawCircle(300, 300, 200);
    circle.endFill(0xFFFFFF);
    input.container.addChild(circle);
    */
    
    bgmask = new PIXI.Graphics();
    input.container.addChild(bgmask);
    
    //corelates to the picture that is being masked
    bgmask.visible = false;
    //mySprite.mask = bgmask;

  },

  render: function(PIXI, input) {
    //  This is called on every frame, put your animation here
    var baseY = input.mouseTouchPosition.y;
    var x1;
    var y1;
    var controlX = 0;
    
    bgmask.clear();
    bgmask.beginFill(0x335B5C);
    
    bgmask.moveTo(0, input.height);
    
    
    // Top point 1
    x1 = 0;
    y1 = baseY - input.audio.frequencies()[100] * 3;
    bgmask.bezierCurveTo(x1, y1, x1, y1, x1, y1);
    
    // Top point 2
    x1 = input.width * 0.2;
    y1 = baseY - input.audio.frequencies()[200] * 2;
    bgmask.bezierCurveTo(x1 + controlX, y1, x1, y1, x1, y1);
    
    // Top point 3
    x1 = input.width * 0.4;
    y1 = baseY + input.audio.frequencies()[300] * 3;
    bgmask.bezierCurveTo(x1 + controlX, y1, x1 - controlX, y1, x1, y1);
    
    // Top point 4
    x1 = input.width * 0.6;
    y1 = baseY + input.audio.frequencies()[400] * 3;
    bgmask.bezierCurveTo(x1 + controlX, y1, x1 - controlX, y1, x1, y1);
    
    // Top point 5
    x1 = input.width * 0.8;
    y1 = baseY + input.audio.frequencies()[500] * 2;
    bgmask.bezierCurveTo(x1 + controlX, y1, x1 - controlX, y1, x1, y1);
    
    // Top point 6
    x1 = input.width * 1.0;
    y1 = baseY + input.audio.frequencies()[600] * 3;
    bgmask.bezierCurveTo(x1 + controlX, y1, x1 - controlX, y1, x1, y1);
    
    // Top point 7 
    x1 = input.width * 1.2;
    y1 = baseY + input.audio.frequencies()[800] * 2;
    bgmask.bezierCurveTo(x1 + controlX, y1, x1 - controlX, y1, x1, y1);
    
    x1 = input.width;
    y1 = input.height;
    bgmask.bezierCurveTo(x1, y1, x1, y1, x1, y1);
    
    bgmask.endFill();
    
  }

});


var shape, shapeColor;

SPF.set({

  at: 'mid', // You can use 'back', 'mid' and 'fore'


  init: function(PIXI, input) {
    
    shape = new PIXI.Graphics();
    input.container.addChild(shape);
    
  },

  render: function(PIXI, input) {
    
    var baseY = input.mouseTouchPosition.y;
    var x;
    var y;
    var controlX = 0;
    
    shape.clear();
    shape.beginFill(0x335B5C);
    //input.colors[5]
    
    shape.moveTo(0, input.height);
    
    
    // Top point 1
    x = 0;
    y = baseY - input.audio.frequencies()[100] * 3;
    shape.bezierCurveTo(x, y, x, y, x, y);
    
    // Top point 2
    x = input.width * 0.2;
    y = baseY - input.audio.frequencies()[200] * 2;
    shape.bezierCurveTo(x - controlX, y, x, y, x, y);
    
    // Top point 3
    x = input.width * 0.4;
    y = baseY - input.audio.frequencies()[300] * 3;
    shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
    
    // Top point 4
    x = input.width * 0.6;
    y = baseY - input.audio.frequencies()[400] * 3;
    shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
    
    // Top point 5
    x = input.width * 0.8;
    y = baseY - input.audio.frequencies()[500] * 2;
    shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
    
    // Top point 6
    x = input.width * 1.0;
    y = baseY - input.audio.frequencies()[600] * 3;
    shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
    
    // Top point 7 
    x = input.width * 1.2;
    y = baseY - input.audio.frequencies()[800] * 2;
    shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
    
    x = input.width;
    y = input.height;
    shape.bezierCurveTo(x, y, x, y, x, y);
    
    shape.endFill();
    
    SPF.midgroundMask(true);
    
   if(input.cast != null){

                    if(input.cast.id == "singer"){  
                     shape.clear();
                        shape.beginFill(0x58B0B0);
                        shape.moveTo(0, input.height);
                        x = 0;
                        y = baseY - input.audio.frequencies()[100] * 3;
                        shape.bezierCurveTo(x, y, x, y, x, y);
                        x = input.width * 0.2;
                        y = baseY - input.audio.frequencies()[200] * 2;
                        shape.bezierCurveTo(x - controlX, y, x, y, x, y);
                        x = input.width * 0.4;
                        y = baseY - input.audio.frequencies()[300] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width * 0.6;
                        y = baseY - input.audio.frequencies()[400] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                         x = input.width * 0.8;
                        y = baseY - input.audio.frequencies()[500] * 2;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width * 1.0;
                        y = baseY - input.audio.frequencies()[600] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                         x = input.width * 1.2;
                        y = baseY - input.audio.frequencies()[800] * 2;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width;
                        y = input.height;
                        shape.bezierCurveTo(x, y, x, y, x, y);
                        shape.endFill();
                        SPF.midgroundMask(true);

                    } else if(input.cast.id == "bass"){
                        shape.beginFill(0x3C6478);
                        shape.moveTo(0, input.height);
                        x = 0;
                        y = baseY - input.audio.frequencies()[100] * 3;
                        shape.bezierCurveTo(x, y, x, y, x, y);
                        x = input.width * 0.2;
                        y = baseY - input.audio.frequencies()[200] * 2;
                        shape.bezierCurveTo(x - controlX, y, x, y, x, y);
                        x = input.width * 0.4;
                        y = baseY - input.audio.frequencies()[300] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width * 0.6;
                        y = baseY - input.audio.frequencies()[400] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                         x = input.width * 0.8;
                        y = baseY - input.audio.frequencies()[500] * 2;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width * 1.0;
                        y = baseY - input.audio.frequencies()[600] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                         x = input.width * 1.2;
                        y = baseY - input.audio.frequencies()[800] * 2;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width;
                        y = input.height;
                        shape.bezierCurveTo(x, y, x, y, x, y);
                        shape.endFill();
                        SPF.midgroundMask(true);

                    } else if(input.cast.id == "drums"){
                        shape.beginFill(0x525C57);
                        shape.moveTo(0, input.height);
                        x = 0;
                        y = baseY - input.audio.frequencies()[100] * 3;
                        shape.bezierCurveTo(x, y, x, y, x, y);
                        x = input.width * 0.2;
                        y = baseY - input.audio.frequencies()[200] * 2;
                        shape.bezierCurveTo(x - controlX, y, x, y, x, y);
                        x = input.width * 0.4;
                        y = baseY - input.audio.frequencies()[300] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width * 0.6;
                        y = baseY - input.audio.frequencies()[400] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                         x = input.width * 0.8;
                        y = baseY - input.audio.frequencies()[500] * 2;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width * 1.0;
                        y = baseY - input.audio.frequencies()[600] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                         x = input.width * 1.2;
                        y = baseY - input.audio.frequencies()[800] * 2;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width;
                        y = input.height;
                        shape.bezierCurveTo(x, y, x, y, x, y);
                        shape.endFill();
                        SPF.midgroundMask(true);

                    } else if(input.cast.id == "all"){
                        shape.beginFill(0x335B5C);
                        shape.moveTo(0, input.height);
                        x = 0;
                        y = baseY - input.audio.frequencies()[100] * 3;
                        shape.bezierCurveTo(x, y, x, y, x, y);
                        x = input.width * 0.2;
                        y = baseY - input.audio.frequencies()[200] * 2;
                        shape.bezierCurveTo(x - controlX, y, x, y, x, y);
                        x = input.width * 0.4;
                        y = baseY - input.audio.frequencies()[300] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width * 0.6;
                        y = baseY - input.audio.frequencies()[400] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                         x = input.width * 0.8;
                        y = baseY - input.audio.frequencies()[500] * 2;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width * 1.0;
                        y = baseY - input.audio.frequencies()[600] * 3;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                         x = input.width * 1.2;
                        y = baseY - input.audio.frequencies()[800] * 2;
                        shape.bezierCurveTo(x - controlX, y, x + controlX, y, x, y);
                        x = input.width;
                        y = input.height;
                        shape.bezierCurveTo(x, y, x, y, x, y);
                        shape.endFill();
                        SPF.midgroundMask(true);
                    } else {
                        shapeColor = 0x000000;
                    }

                }

  },
  
  mouseUpTouchEnd: function(PIXI, input) {
    
    if (showBackgroundMask == true) {
      SPF.midgroundMask(false);
      bgmask.visible = true;
      //mySprite.mask = bgmask;
      shape.visible = false;
      showBackgroundMask = false;
    } else {
      SPF.midgroundMask(true);
      bgmask.visible = false;
      mySprite.mask = null;
      shape.visible = true;
      showBackgroundMask = true;
    }
    
  }

         
});

SPF.set({

  at: 'fore', // You can use 'back', 'mid' and 'fore'


  init: function(PIXI, input) {

    
  },

  render: function(PIXI, input) {
    //  This is called on every frame, put your animation here
    
    
    
  }
  
});


SPF.info({
            debug: false,
            title: "hacked wave",
            tip: "move about and click",
            firstName: "Pernille",
            lastName: "Hjorth",
            email: "pernille@ph-oto.dk"
        });

        SPF.start();
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console