Is there any way to manage the z index of the shape/image object in p5.js?

edited October 2016 in p5.js

I read the refrence, it seems not to find the relevant api............... (ps:not the html element z-index css attribute, but the z index of 'shape' or 'P5.image' object on the canvas)

Tagged:

Answers

  • We can access the actual underlying HTMLElement from any p5.Element via its property elt:
    http://p5js.org/reference/#/p5.Element/elt

  • hi,GoToLoop,I'm very glad you can answer my questions, I do not mean the html element z-index css attribute, but the z index of 'shape' or 'P5.image' object on the canvas

  • Answer ✓

    @ice_frog - what z index property? There is no such thing for elements added to an HTML5 canvas: elements are stacked in the order they are drawn. Simply change the order of drawing to change the order they are displayed... Or draw to image buffers and change the order in which these are rendered to the canvas.

  • edited October 2016

    You mean the z coordinate in a 3D sketch?

    You can use translate before drawing the shape/image.

    If what you want is to control the order in which the objects appear in a 2D sketch them it's like blindfish said.

Sign In or Register to comment.