-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
Combining shapes #1225
Comments
Thanks for opening a new issue. The team has been notified and will review it as soon as possible. For urgent issues and priority support, visit https://xscode.com/matteobruni/tsparticles |
Hi @lhunath, Thanks for the suggestions! I try to answer all of them:
Hope to have answered all questions, and thanks again for the combined shapes suggestion, it's interesting to bring it to |
Stale issue message |
Here's the PR! #5213.⚡ Sweep Free Trial: I used GPT-4 to create this ticket. You have 4 GPT-4 tickets left for the month and 2 for the day. For more GPT-4 tickets, visit our payment portal. Actions (click)
Step 1: 🔎 SearchingI found the following snippets in your repository. I will now analyze these snippets and come up with a plan. Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description.
tsparticles/plugins/emitters/src/Options/Interfaces/IEmitter.ts Lines 1 to 86 in dcae1ab
tsparticles/engine/src/Utils/CanvasUtils.ts Lines 130 to 274 in dcae1ab
tsparticles/engine/src/Options/Interfaces/IOptions.ts Lines 1 to 142 in dcae1ab
tsparticles/shapes/text/src/TextDrawer.ts Lines 1 to 105 in dcae1ab
I also found the following external resources that might be helpful:Summaries of links found in the content: https://www.w3schools.com/tags/canvas_font.asp: The page is about the HTML canvas font property. It provides a tutorial and reference for using the font property to set or return the font properties for canvas text. The font property uses the same syntax as the CSS font property. The default value is 10px sans-serif. The page also includes an example of how to write text on the canvas using the font property. The page mentions other related properties such as fillStyle, textAlign, and textBaseline. It also provides syntax and property value information for the font property. The page concludes with information about browser support for the canvas element and a link to the canvas reference. There are also comments from users discussing a feature request for particles that combine multiple types of shapes, as well as questions about the character shape and documentation for configuration values. The user is requesting a feature in the tsparticles library that allows combining multiple types of shapes into one particle. They propose adding a new shape type called "combined" that would allow for layering different shapes on top of each other. The user suggests that the configuration for the particle should be applied to both shapes, and potentially allow for different configurations for each layer. The user also asks about the difference between the "character" and "char" shape types, and requests more documentation on certain configuration values. The library maintainer responds by suggesting that the user can create a custom shape to handle the combined shapes, and mentions that a new shape type can be added in the upcoming 2.0 version of the library. The maintainer also provides explanations for the "sync", "speed", "frequency", and "style" configuration properties. Step 2: ⌨️ Coding
• Import necessary classes and interfaces from "tsparticles-engine". • Create a new class "CombinedDrawer" that implements the "IShapeDrawer" interface. • Add an array property to the "CombinedDrawer" class that will hold the shapes to combine. • Implement the "draw" method to draw the shapes in the array in the correct order. • Implement the "getSidesCount" method to return the maximum sides count of the shapes in the array. • Export the "CombinedDrawer" class.
• Add "combined" to the list of valid shape types.
• Modify the "init" method to check if the particle's shape type is "combined" and then initialize the shapes in the "combined" shape's array.
• Modify the "drawShape" and "drawShapeAfterEffect" methods to check if the particle's shape type is "combined" and then draw the shapes in the "combined" shape's array in the correct order. Step 3: 🔁 Code ReviewI have finished reviewing the code for completeness. I did not find errors for . 🎉 Latest improvements to Sweep:
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. |
I think this can be closed, if someone needs a combined shape, it can create a custom shape to handle correctly the double values. Just a thought. |
Which version are you using?
1.18.0
Is the latest version affected?
Which library are you using?
tsparticles
)Is your feature request related to a problem? Please describe.
I need particles that are characters with a background. There does not appear to be a way to achieve this. This feature request proposes a solution that would allow for a lot of flexibility.
Describe the solution you'd like
I'd like to propose particles that allow combining multiple types of shapes into one.
For instance, one might define:
The resulting effect would behave as if both shapes were layered on top of each other when rendered.
A concern would be how the particle's configuration is applied. A simple solution would be to apply the same configuration to both shapes of the particle (ie. position, color, etc). A more ambitions solution would allow for configuration to specify a shape layer to apply the configuration onto, allowing, for example, a background circle shape with a different color from the foreground character shape.
Describe alternatives you've considered
Alternative solutions:
Additional context
If there are other solutions, please advise!
Side questions
character
and achar
shape type?sync
, how doesspeed
work,frequency
, how to use characterstyle
, etc)Checklist
shapes/combined/src/CombinedDrawer.ts
✅ Commit54b5939
engine/src/Options/Interfaces/IOptions.ts
❌ Failedengine/src/Core/Particle.ts
❌ Failedengine/src/Utils/CanvasUtils.ts
✅ Commitc7f3460
The text was updated successfully, but these errors were encountered: