Guest User

Untitled

a guest
Dec 12th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. var app = new PIXI.Application(900,600);
  2. document.body.appendChild(app.view);
  3.  
  4.  
  5. // Create background image
  6. var background = PIXI.Sprite.fromImage('img/5_.jpg');
  7. background.width = app.renderer.width;
  8. background.height = app.renderer.height;
  9.  
  10.  
  11.  
  12. app.stage.addChild(background);
  13.  
  14.  
  15. // Stop application wait for load to finish
  16. app.stop();
  17.  
  18. PIXI.loader.add('shader', '/js/shader.frag')
  19. .load(onLoaded);
  20.  
  21. var filter;
  22.  
  23.  
  24. function onLoaded(loader,res) {
  25.  
  26.  
  27. filter = new PIXI.Filter(null, res.shader.data);
  28.  
  29. background.filters = [filter];
  30.  
  31. filter.uniforms.currentimage = background._texture;
  32. app.start();
  33. }
  34.  
  35.  
  36. app.ticker.add(function(delta) {
  37.  
  38. });
Add Comment
Please, Sign In to add comment