P5.js: canvas.position is not a function

Created on 2 May 2017  路  1Comment  路  Source: processing/p5.js

Hey, I'm trying to center the position of the canvas of my game with your library (and tips here) instead of CSS but it doesn't work, the var returned by createCanvas(x,y) doesn't have the function 'position' defined.

Error :
Uncaught TypeError: canvas.position is not a function
at centerCanvas (game.js:105)

Code is available here :
https://github.com/NinoDLC/Nodino/blob/canvas_position_not_function/public/game/game.js#L105

Most helpful comment

You need to include a link to the p5.dom library in your html file, more info here:
https://p5js.org/reference/#/p5.Element/position

The github issues are just for bugs with p5.js, please use the forum for general programming questions and help in the future:
https://forum.processing.org

>All comments

You need to include a link to the p5.dom library in your html file, more info here:
https://p5js.org/reference/#/p5.Element/position

The github issues are just for bugs with p5.js, please use the forum for general programming questions and help in the future:
https://forum.processing.org

Was this page helpful?
0 / 5 - 0 ratings