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

              
                
<canvas id="mycanvas"></canvas>
<script id="vertShader" type="x-shader/x-vertex">
//pixi.js/packages/core/src/fragments/default.vert
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
uniform mat3 projectionMatrix;
varying vec2 vTextureCoord;
void main(void)
{
    gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
    vTextureCoord = aTextureCoord;
}
</script>
<script id="fragShader" type="x-shader/x-frag">
varying vec2 vTextureCoord;
uniform sampler2D uSampler;
uniform float delta;
void main(void)
{
    vec4 color = texture2D(uSampler, vTextureCoord);
    if (color.a != 0.0){
        color.r = delta;
        color.g -= delta;
        color.b -= delta;
    }
    gl_FragColor = color;
}
</script>


<img id="myimg" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG8AAAEJCAYAAACaH3mTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyNpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1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VwbiW0cV9o1kDzTJsgDeQpLy8rEwsbnYKy0nWklD+SRB/JAHnkgD+SBPPJAHsgDeeSBPJBHHsgDeYjSymdYUn9duelzSB7IA3nkgTyQRx7IA3mI0pmt+bv+jSDJIw/kgTzyQB7IA3nkgTyQB/LIA3kgjzyQB/JAHnkgD+SBPPKQj7E8dFtV1WrSgY/WgqHUryvnOkdd16uSB/LIA3kYcZc4+oebp5wksrW2vHJ87M6Tty9LPse4SozkmTZBHshTWAopLG1EYQF55IE8lF9YYsNdLjGrkcIieSCPPJCHBvknwAC6yNvkOgkRdwAAAABJRU5ErkJggg=="/>
              
            
!

CSS

              
                    body{
        margin: 0;
    }

#myimg{
  display: none;
}

    canvas{
        display: block;
        background: blue;
    }
              
            
!

JS

              
                const canvas = document.getElementById("mycanvas");

const app = new PIXI.Application({
  view: canvas,
  width: window.innerWidth,
  height: window.innerHeight
});

const vShader = vertShader.innerText;
const fShader = fragShader.innerText;
const uniforms = {
  delta: 0
};

//vShader = new PIXI.filters.AbstractFilter().vertexSrc;
const myFilter = new PIXI.Filter(vShader, fShader, uniforms);

const texture = PIXI.Texture.from(myimg.src);
const img = new PIXI.Sprite(texture);
img.x = app.screen.width / 2;
img.y = app.screen.height / 2;
img.anchor.x = 0.5;
img.anchor.y = 0.5;
//img.filters = [new PIXI.filters.BlurFilter()];
img.filters = [myFilter];
app.stage.addChild(img);

app.ticker.add(animate);

let delta = 0;
function animate() {
  delta += 0.1;
  uniforms.delta = 0.5 + Math.sin(delta) * 0.5;
  //img.rotation += 0.1;
}

              
            
!
999px

Console