Jump to content

How to morph shapes dynamically in Canvas2D


Andy Zhuang
 Share

Recommended Posts

I want to draw 2D path (line, rectangle, curve, etc.) dynamically with mouse moving in Canvas2D. And can also modify the path's end points in the future.

I have found how morph mesh in 3D space dynamically.  But it seems that can be applied to Canvas2D's shapes.

Now I remove the old shape and  create a new one when need morph the old shape. But I am not sure it has performance issue, especially when morph path containing many vertexes. 

My code: http://www.babylonjs-playground.com/#NF6H0S

Any better ways for this? Thanks.

Link to comment
Share on other sites

On 08/05/2017 at 10:56 PM, Deltakosh said:

Not a big deal. This is ok but you may want to create a merged Lines2D object at some point in time (instead of multiple Lines2D)

Yes @Deltakosh  

When one line's endpoint snap to another line's endpoint, I want merge them at the joint point. Any ideas for this? Thanks.

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