fullerton Posted December 26, 2019 Share Posted December 26, 2019 I have a little pixi.js JavaScript I would like to have placed on a specific place on a wordpress page. Right now, it is displaying at the bottom of the page, despite me defining that it should be placed within a canvas. (it seems to render correctly on here, but not on my wordpress site) Please let me know where I went wrong. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta charset="UTF-8" /> <title>Test Page</title> </head> <body> <script src="https://pixijs.download/release/pixi.min.js"></script> Some pre-image text goes here <br /><br /> <canvas id="myCanvas" width="683" height="455" style="border:8px solid #076e21; width:683; height:455;"> <img src="https://devlucidpix.wpengine.com/wp-content/uploads/2019/12/4-illumination-tree-lights-morton-arboretum.jpg" width="683" height="455" alt=""/> </canvas> <script> let app = new PIXI.Application({width:683, height:455, antialias:true, view:myCanvas}); document.body.appendChild(app.view); let img = new PIXI.Sprite.from("https://devlucidpix.wpengine.com/wp-content/uploads/2019/12/4-illumination-tree-lights-morton-arboretum.jpg"); img.width = 683; img.height =455; app.stage.addChild(img); depthMap = new PIXI.Sprite.from("https://devlucidpix.wpengine.com/wp-content/uploads/2019/12/4-illumination-tree-lights-morton-arboretum_depth.jpg"); depthMap.width = 683; depthMap.height = 455; app.stage.addChild(depthMap); displacementFilter = new PIXI.filters.DisplacementFilter(depthMap); app.stage.filters = [displacementFilter]; window.onmousemove = function(e) { displacementFilter.scale.x = (window.innerWidth / 2 - e.clientX) /20; displacementFilter.scale.y = (window.innerHeight / 2 - e.clientY) /20; }; </script> <br /><br /> And here's some text after it. </body> Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 27, 2019 Share Posted December 27, 2019 let app = new PIXI.Application({width:683, height:455, antialias:true, view:myCanvas}); document.body.appendChild(app.view); well, you move your canvas to the bottom with that "appendChild". just remove that line Quote Link to comment Share on other sites More sharing options...
fullerton Posted December 27, 2019 Author Share Posted December 27, 2019 Perfect, thank you! ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted December 27, 2019 Share Posted December 27, 2019 I'm glad its resolved. Welcome to the forums! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.