GithubHelp home page GithubHelp logo

Graphics new method 'drawPolygon' about easeljs HOT 7 OPEN

hsk-kr avatar hsk-kr commented on May 27, 2024
Graphics new method 'drawPolygon'

from easeljs.

Comments (7)

danzen avatar danzen commented on May 27, 2024 2

Very nice. There is a drawPolyStar for regular polygons with a tiny API of dp(). I guess something like pg() might work - anyone else have a thought? I know most draws start with d but not drawRoundRectComplex. Another option might be dg(). We could double up in the chart below with dp/pg.

Another thing that I have found that even if you cp() a the end - which may be done automatically under the hood, that the line corner does not take the same corner point setting. So I think on our version of createjs drawPolyStar for ZIM, we keep going for one more turn - we will check that out as we consider the addition.

image

from easeljs.

danzen avatar danzen commented on May 27, 2024 1

@hsk-kr - would you like to try a pull request? Also, note that the version 1 of CreateJS is ES5. If that is too much to ask, we can recode it. Also, when you do, I would suggest wrapping around beyond the end point to the second point again so that the bevel or miter on the polygon is consistent. Otherwise, even with cp() it is just straight line across. See #1046

from easeljs.

hsk-kr avatar hsk-kr commented on May 27, 2024 1

I haven't used CreateJS for a while because of my works. when I have some time, I'll try it.
Thanks for your suggestion.

from easeljs.

danzen avatar danzen commented on May 27, 2024 1

This has been committed - thanks @hsk-kr for the suggestion!
5366838

Not in the docs yet... so will leave this open until that happens.

from easeljs.

danzen avatar danzen commented on May 27, 2024 1

Here is an example of it working on the ZIM version of CreateJS - with same code as added to the repo here.
https://zimjs.com/explore/molnar.html
image

from easeljs.

danzen avatar danzen commented on May 27, 2024

@hsk-kr I coded this in es5. In ZIM we offer options for parameters like pass in [{x,y},}{x,y}] or [[x,y],[x,y]] or [x,y,x,y,x,y] or x,y,x,y,xy - it takes a few lines to test this and accommodate this. For createjs do we think it is best to offer one way for minimal size? It seems that way, so we will probably use one way. The question is... which way is consistent with the others. Graphics.BezierCurveTo ( cp1x, cp1y, cp2x, cp2y, x, y ) uses individual parameters. This I think is a little harder to use for a series of points - not so bad with the ES6 spread operator but annoying in ES5. I think the array of arrays is probably the most organized and basic way. That is the way that you chose and that seems based on other library implementations I presume.

I have yet to work out how to change the docs - but will add the code to the Graphics class and post here.

from easeljs.

hsk-kr avatar hsk-kr commented on May 27, 2024

I'm sorry. I couldn't give you a good advice.
Thanks for taking my opinion.

from easeljs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.