Jump to content

How to clear canvas 2D


excelsior
 Share

Recommended Posts

Hey so i'm trying to display text when the cursor over a mesh with canvas 2D. So the text appear okay but now when the cursor leave the mesh i want the text de disapear ? how can i do that is there some kind of clear rect methods  on a 2D canvas ? 

Link to comment
Share on other sites

Ah - I think @excelsior has an excellent question. How to hide the entire 2D canvas (all elements) without a .dispose operation clearing all elements from memory. I'm going to guess that there are several obvious answers to this, however what is the most efficient way to hide the entire 2D canvas without diposing of the canvas from memory cache?

DB

Link to comment
Share on other sites

20 hours ago, dbawel said:

Ah - I think @excelsior has an excellent question. How to hide the entire 2D canvas (all elements) without a .dispose operation clearing all elements from memory. I'm going to guess that there are several obvious answers to this, however what is the most efficient way to hide the entire 2D canvas without diposing of the canvas from memory cache?

DB

You have two properties:

  • levelVisible: if you set it to false, the primitive and its content will be hidden. You can set it on the Canvas, because the Canvas is also a primitive.
  • isVisible: this property let you know if the primitive is visible or not. Because if a given primitive has levelVisible to true but one of its parent has its levelVisible to false, the primitive will be hidden. So you can't rely on levelVisible to get the actual visible state.
Link to comment
Share on other sites

@Nockawa - I use these for meshes, materials, etc., but are you saying that I can use these as a single operation to set the visibility of an entire canvas collectively in Javascript and not HTML? If so, this is not something I was aware of, and would be quite useful for any canvas I might initiate. Not only a 2D canvas?

Thanks,

DB

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...