KenC

Displaying the canvas

Recommended Posts

I'm trying to follow the first tutorial. I don't understand why I don't see anything unless I uncomment out the resize() (which is not in the tutorial), and even when I do, the background color is not as specified in the Application object. Any pointers would be appreciated.

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>Hello World</title>
</head>
<body>
  <script src="pixi/pixi.min.js"></script>
  <script type="text/javascript">

    //Create a Pixi Application
    let app = new PIXI.Application({
        width: 256, 
        height: 256,                       
        antialiasing: true, 
        transparent: false, 
        backgroundColor: 0x0000f0,
        resolution: 1
    });
    // If I comment below, then I see a nothing. Also, why is the canvas
    // background black instead of 0x0000f0?
    app.renderer.resize(256, 256);
    document.body.appendChild(app.view);
  </script>
</body>
</html>

 

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.