Jump to content

rendering to canvas id


Design Build Play
 Share

Recommended Posts

what Pixi do is just creating the canvas object for you.
if you want to use your own canvas you need to specify the canvas element while creating pixi renderer.

suppose you have this canvas in your html document

 

<canvas id="myCanvas"  width="400" height="400"></canvas> 

 

you can tell Pixi to use it by calling

 

 

var myView = document.getElementById('myCanvas');var renderer = PIXI.autoDetectRenderer(400, 400, myView); 

instead of
 

 

var renderer = PIXI.autoDetectRenderer(400, 400); 

 

 

Link to comment
Share on other sites

  • 5 years later...
  • 5 months later...

Hi I tried using image.thumb.png.0611b5467fc8580ae4d00a425a5be89b.png but not much of a success.

 

I am trying to create an html input box so that i can take user inputs as pixi.js doesn't provide one!

So i tried to create a canvas along withy pixi app but the canvas shifts the rest of the view of the app:

image.thumb.png.1ca4e536f9f52f33fbd455f47f0cc3b1.png 

which was earlier something like this:

image.thumb.png.43ea7b3b4e3227760bf8f570efc21cdd.png

Please help!

Link to comment
Share on other sites

@KanikaMehra 

That's thread of 2013 year and very old pixiJS version.

If you searched some more time you could stumble across modern PixiJS docs: http://pixijs.download/dev/docs/PIXI.Renderer.html and "view" parameter. 

Please, before you do that again, read the docs and wiki: https://github.com/pixijs/pixi.js/wiki, and next time specify PixiJS version that you are using, and don't bump 5 year old threads.

 

Link to comment
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...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...