phetsims / kite

A library for creating, manipulating and displaying 2D shapes in JavaScript.
http://scenerystack.org/
MIT License
15 stars 6 forks source link

Ability to create a Shape from one or more segment types directly #54

Closed jonathanolson closed 7 years ago

jonathanolson commented 9 years ago

See https://github.com/phetsims/bending-light/issues/174#issuecomment-137877435 for a use-case, since we'd need to extract out the Arc to mutate. Much easier to directly create a Shape based on one segment.

It would be great to tell kite to use more than 1 connected (or unconnected) segments, also.

jonathanolson commented 7 years ago

This is possible, via creating:

var segments = // something
var subpath = new kite.Subpath( segments ); // can include closed flag if closed
var shape = new kite.Shape( [ subpath ] );