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;
  cursor: none;
}


            
          
!
            
              var _Graphic;
var _Masking;
var _line;
var _line2;
var _line3;
var _line4;
var _line5;
var _line6;
var _mouse;

var _MaskingContainer1;
var _MaskingContainer2;

var _MaskingAlternative;

// 'Back'
SPF.set({

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

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

        
      
  },
  
  resize :function(PIXI, input) {

                var w =  input.width;
                var h =  input.height;

                _Graphic.clear();
                _Graphic.beginFill(input.colors[18], 1);
                _Graphic.drawRect(0,0,w,h);
                _Graphic.endFill();
  },

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

});

// 'Mid'
SPF.set({
  
  at: 'mid',
  
  init: function(PIXI, input) {
      
      _MaskingContainer1 = new PIXI.Container()
      _MaskingContainer2 = new PIXI.Container()
      input.container.addChild(_MaskingContainer1);
      input.container.addChild(_MaskingContainer2);
    
      _Masking = new PIXI.Graphics()
      _line = new PIXI.Graphics()   
      _line2 = new PIXI.Graphics()
      _line3 = new PIXI.Graphics()
      _MaskingContainer1.addChild(_Masking)
      _MaskingContainer1.addChild(_line)
      _MaskingContainer1.addChild(_line2)
      _MaskingContainer1.addChild(_line3)
      
      _MaskingAlternative = new PIXI.Graphics();
      _line4 = new PIXI.Graphics()   
      _line5 = new PIXI.Graphics()
      _line6 = new PIXI.Graphics()
      _MaskingContainer2.addChild(_MaskingAlternative)
      _MaskingContainer2.addChild(_line4)
      _MaskingContainer2.addChild(_line5)
      _MaskingContainer2.addChild(_line6)
      
      

      SPF.midgroundMask(true);
      
  },
  
            mouseDownTouchStart: function(PIXI, input) {
                SPF.midgroundMask(false);
                _MaskingContainer2.visible = !_MaskingContainer2.visible;
            },

            mouseUpTouchEnd: function(PIXI, input) {
                SPF.midgroundMask(true);
            },
            
            isTouchDeviceStart: function(PIXI, input) {
                SPF.midgroundMask(false);
            },
            
            isTouchDeviceEnd: function(PIXI, input) {
                SPF.midgroundMask(True);
            },
                      
  
           resize :function(PIXI, input) {

               var w =  input.width;
               var h =  input.height;

               _Masking.clear();
               _Masking.beginFill(input.colors[12], 1);
               _Masking.lineStyle(20, 0xffffff, 1);
               _Masking.drawRect(0,0,w,h);
               _Masking.endFill();
               
               _line.clear();
               _line.beginFill(0xFFFFFF);
               _line.drawRect(w * 0.25, 0, 10, input.height);
               _line.endFill();
             
               _line2.clear();
               _line2.beginFill(0xFFFFFF);
               _line2.drawRect(w * 0.497, 0, 10, input.height);
               _line2.endFill();
             
               _line3.clear();
               _line3.beginFill(0xFFFFFF);
               _line3.drawRect(w * 0.75, 0, 10, input.height);
               _line3.endFill();
                            
                //Alternative
               _MaskingAlternative.clear();
               _MaskingAlternative.beginFill(0xff0000, 1);
               _MaskingAlternative.lineStyle(20, 0x000000, 1);
               _MaskingAlternative.drawRect(0,0,w,h);
               _MaskingAlternative.endFill();
             
               _line4.clear();
               _line4.beginFill(0x000000);
               _line4.drawRect(w * 0.25, 0, 10, input.height);
               _line4.endFill();
             
               _line5.clear();
               _line5.beginFill(0x000000);
               _line5.drawRect(w * 0.497, 0, 10, input.height);
               _line5.endFill();
             
               _line6.clear();
               _line6.beginFill(0x000000);
               _line6.drawRect(w * 0.75, 0, 10, input.height);
               _line6.endFill();
           },
  
});

// 'Fore'
SPF.set({
  
  at: 'fore',
  
  init: function(PIXI, input) {
    
      // Initialize the pixi Graphics class
      _mouse = new PIXI.Graphics();

      // Set the fill color
      _mouse.beginFill(0xffffff); // Red

      // Draw a circle
      _mouse.drawCircle(0, 0, 5); // drawCircle(x, y, radius)
      

      // Applies fill to lines and shapes since the last call to beginFill.
      _mouse.endFill();

      // Add the graphics to the stage
      input.container.addChild(_mouse);
    

  },
 
  
  render: function(PIXI, input) {
    
      _mouse.x = input.mouseTouchPosition.x;
      _mouse.y = input.mouseTouchPosition.y;
    
    
    // fade with music
    //  var v = input.audio.frequencies()[100];
    //  _mouse.alpha = v / 200;
    
    //Fade pulsating
    var fadeSpeed = 4;
    var fade = Math.sin(input.currentTime * fadeSpeed) * 0.5 + 0.5;
    _mouse.alpha = fade;
    
    /*if (input.currentTime == null || input.currentTime <= 5) {
      
      // Get the frequency 100
      var v = input.audio.frequencies()[100];

      // Set the alpha of the square background as the
      // frequency divided by 200
      _mouse.alpha = v / 200;
        
    } else {
      
      _mouse.clear();
    
      _mouse.beginFill(input.colors[2]);
      
      _mouse.drawRect(0, 0, input.width, input.height);
    
      _mouse.endFill();
      
    },*/
    
  },

  
});

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