Andy Zhuang Posted May 8, 2017 Share Posted May 8, 2017 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 8, 2017 Share Posted May 8, 2017 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) Quote Link to comment Share on other sites More sharing options...
Andy Zhuang Posted May 10, 2017 Author Share Posted May 10, 2017 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. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 10, 2017 Share Posted May 10, 2017 Just recreate a Lines2D with all points from previous Lines2D objects. Merging the coordinates should work Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.