Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shapeMode() new feature #3509

Open
2 tasks done
hellonearthis opened this issue Feb 9, 2019 · 10 comments
Open
2 tasks done

shapeMode() new feature #3509

hellonearthis opened this issue Feb 9, 2019 · 10 comments

Comments

@hellonearthis
Copy link
Contributor

Processing has a shapeMode() function that lets you set the draw position to be CENTER, CORNER or CORNERS This is missing from P5 and means that extra work is needed when defining a shape.

  • New feature request

Most appropriate sub-area of p5.js?

New feature details:

shapeMode() function
that lets you set the draw position to be.
shapeMode(CENTER) shapeMode(CORNER) shapeMode(CORNERS)

@sanketsingh24
Copy link
Contributor

sanketsingh24 commented Feb 9, 2019

Really cool feature 👍 Would like to work on this. Although I am not free this weekend, would implement the feature on Monday.

@hellonearthis hellonearthis changed the title shameMode() new feature shapeMode() new feature Feb 9, 2019
@sanketsingh24
Copy link
Contributor

Hello, What I found out was there is no shape() function in p5, but the support for .OBJ files is via model(), while there is no native support for .SVG files, but can be added via image(), which has the same imagemode(). Well, I don't see the need for the shapemode() feature, but something on the lines of modelmode() can be implemented, but I don't know about the .SVG, and custom shapes, which has to be implemented first.@hellonearthis @stalgiag Can you please present your views on this?

@hellonearthis
Copy link
Contributor Author

I was asking about shapeMode() in relation to beginShape() used in making custom shapes.
Even having access to it's width and height would help.
SVG would be a different story.

@stalgiag
Copy link
Contributor

Hi @sanketsingh24 I believe the requested feature is an equivalent to rectMode for custom shapes made with beginShape() in the 2D renderer. @hellonearthis I think that making this would present a number of challenges because there currently is not an equivalent to PShape in p5. See this discussion for an explanation of the challenges involved in creating this.

@hellonearthis
Copy link
Contributor Author

hellonearthis commented Feb 25, 2019

I think your over complexing it. Yes, it would be an equivalent of rectMode. It would not be an SVG related thing as far as I can tell. It would be an attribute of beginShare().
Maybe I should have said it was beginShapeMode( CORNER || CORNERS || RADIUS || CENTER )

I don't see an easy way to do it as a p5 custom shape doesn't built/record it's width or height as it's being constructed. So a sketch like this means the user has to do extra coding to build that data themselfs.

Is there a way that shapeBegin() could be an object, like let my-shape = beginShape() so that things like my-shape.width my-shape.height be accessed and (off topic) have that shape drawn using another function like paint(my-shape,x,y). Sorry digressed, just knowing the width and height so CENTER would help rotating custom shapes.

@stalgiag
Copy link
Contributor

I agree this is separate from SVG support, but the requested feature would suggest a p5.Shape class that stores and updates info about the bounds and mode so that it can shift drawing accordingly.

@sanketsingh24
Copy link
Contributor

Ok, so it should be only for custom shapes made by beginshape() ? I would start to work on this now.

@devashish1099
Copy link

@stalgiag i would like to work on this issue

@stalgiag
Copy link
Contributor

Hi @devashish1099 I am not sure if we have a consensus on this feature yet.

I will add the discussion label to attract opinions on whether the community is in favor of adding a p5.Shape class.

@Alex23rodriguez
Copy link

Has there been any progress? I'm working on visualising some 3D shapes made out of cubes and it would be very nice if I could create a custom shape to eliminate the lines between the cubes.
3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Out of Scope
Development

No branches or pull requests

6 participants