williamngan / pts

A library for visualization and creative-coding
https://ptsjs.org
Apache License 2.0
5.16k stars 182 forks source link

Parameter confused #179

Open tcper opened 2 years ago

tcper commented 2 years ago

pts: GroupLike

Parameters like this really confused, What is the differences of PtLikeIterable or GroupLike Or construct a Group(new Pt(x,y), new Pt(a,b)), Group([1,2,3,4]) In practice, I think all these objects are different, because some works in Curve, some don't.

I think this is the biggest obstacle in this project, people have to read your Demo code to try which works.

williamngan commented 2 years ago

Thanks for the feedback @tcper -- there might be some ways to simplify. I'll look into this.

williamngan commented 2 years ago

Following up on this. As a starting point, I've updated the documentations so it's clearer what these types mean.

Not sure if I can simplify it further. Needed the Iterable types as we want to support non-array iterables.

When in doubt, just pass a Group instance which should work always :)