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 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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              <label for="input">Type Here</label>
<textarea name="input" id="input">
Hello
world
</textarea>
            
          
!
            
              // @import url('https://fonts.googleapis.com/css?family=Notable');
@import url('https://fonts.googleapis.com/css?family=Rubik+Mono+One');

body{
  color: saturate(lighten(#C7A53F,10%),35%);
  background: #222;
  font-family: "Rubik Mono One", monospace;
  font-size: 95px;
  line-height: .8;
}

canvas{
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  max-width: 100%;
  max-height: 100%;
}


label { 
  position: fixed;
  top: 0.5em;
  font-size: .2em;
  text-align: center;
  width: 100%;
  color: #FFF;
  cursor: pointer;
}
#input {
  color: inherit;
  font: inherit;
  font-size: 0.5em;

  position: fixed;
  left: 0;
  right: 0;
  top: .5em;

  z-index: 2;
  width: 100%;
  height: 5em;
  background: transparent;
  border: none;
  padding: .5em 24%;
  box-sizing: border-box;
  text-align: center;
  margin: auto;
  white-space: normal;
  opacity: 0.3;
  outline: none;
  overflow-x: hidden;
  overflow-y: auto;

  &:hover { opacity: .7; }
}
            
          
!
            
              console.clear();

const fontSize = 13;
document.body.style.fontSize = fontSize + 'vw';

function ease(current,target,ease){ return current + (target - current) * ( ease || 0.2 ); }

var width = window.innerWidth;
var height = window.innerHeight;


var stage = new PIXI.Container();
var renderer = PIXI.autoDetectRenderer(width, height, {transparent:true});
// renderer.autoResize = true;

document.body.appendChild(renderer.view);


/* ---------------------------------- */


const displacementSprite = PIXI.Sprite.fromImage('https://s3-us-west-2.amazonaws.com/s.cdpn.io/39255/displacement-cross-2.jpg');
displacementSprite.texture.baseTexture.wrapMode = PIXI.WRAP_MODES.REPEAT;
//displacementSprite.texture.baseTexture.wrapMode = PIXI.WRAP_MODES.MIRRORED_REPEAT;
// displacementSprite.texture.baseTexture.wrapMode = PIXI.WRAP_MODES.CLAMP;

displacementSprite.scale.y = .9;
displacementSprite.scale.x = .7;
displacementSprite.x = displacementSprite._x = 0;
displacementSprite.y = displacementSprite._y = 0;

const displacementFilter = new PIXI.filters.DisplacementFilter(displacementSprite);
displacementFilter.padding = 100;
displacementFilter.scale.x = 65;
displacementFilter.scale.y = 5;


var count = 0;

function animate() {
  requestAnimationFrame(animate);
  
  displacementSprite.x = ease(
    displacementSprite.x, 
    displacementSprite._x + (Math.sin(count) * 10), 
    0.05
  );
  displacementSprite.y = ease(
    displacementSprite.y, 
    displacementSprite._y + (Math.cos(count) * 10),
    0.05
  );
  
  count += 0.01;
  renderer.render(stage);
}
animate();

/* ---------------------------------- */ 

function TrackPointer(callback){

  var frame;
  var pointer = {
    cx: 0,
    cy: 0,
    px: 0,
    py: 0,
    track: function(e){
      e = e.touches ? e.touches[0] : e;
      // pointer.cx = ((e.clientX / window.innerWidth) - 0.5) * 2;
      // pointer.cy = ((e.clientY / window.innerHeight) - 0.5) * 2;
      pointer.px = e.clientX;
      pointer.py = e.clientY;
      frame = frame || requestAnimationFrame(update);
    },
  };

  callback = (callback || function(){});

  function update(){
    frame = null;
    callback(pointer);
  }

  document.addEventListener('mousemove',pointer.track);

  return pointer;
}

TrackPointer(function(pointer){
  displacementSprite._x = pointer.px / 4;
  displacementSprite._y = pointer.py / 2;
});

/* ---------------------------------- */

const style = new PIXI.TextStyle(
  {
    fontFamily: '"Rubik Mono One", Notable, monospace, Arial', 
    fill: 0xf5c944, 
    align: 'center',
    wordWrap: true,
    wordWrapWidth: window.innerWidth,
    whiteSpace: 'normal',
    padding: 50
  });


function updateStyle(){
  style.fontSize = fontSize * (window.innerWidth / 100);
  style.lineHeight = style.fontSize * 0.8;
  style.padding = 50 + Math.random();
}
updateStyle();

const text = new PIXI.Text('',style);
text.filters = [displacementFilter];

stage.addChild(displacementSprite);
stage.addChild(text);


function updatePosition(){
  text.pivot.x = ( text.width / 2 );
  text.pivot.y = ( text.height / 2 );
  text.position.x = (renderer.width / 2);
  text.position.y = (renderer.height / 2);
}

function updateText(value){
  text.text = value;
  updatePosition();
}

const elInput = document.getElementById('input');
updateText(elInput.value);

setTimeout(function(){
  updateText(elInput.value)
},1000);

elInput.addEventListener('input', (e)=>{
  updateText(elInput.value);
});



window.addEventListener('resize',function(){
  renderer.resize( window.innerWidth, window.innerHeight );
  style.wordWrapWidth = window.innerWidth;
  updateStyle();
  updatePosition();
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console