Generate this kind of 2d burst or pulse

Started by
1 comment, last by frob 7 years, 12 months ago
Hi, I'm currently trying to develop a game using Cocos2d-x using C++ :mellow:
I really need to generate this burst or (donut-shaped) pulse.
I'm having a difficult time how to generate such shape.
At first, I was thinking of scaling the image but that didnt work out because the line or "diameter" of the donut shape gets bigger accordingly..
Any experienced coders who can provide an equation of this thing? or maybe "mathematics" is more exact.
If you guys can provide ANY help, suggestion, or alternative recommendation, I'll be so glad^^
:)
Advertisement

Don't post in multiple forums, your other posts have been removed. If you want it in some other sub-forum then ask a moderator to move it instead.

Both the ring and the fading internal shape could be handled easily enough with a shader if you can do that in your code. The shader could look at the pixel's distance from the center. If it is within the outer ring's distance set it to one color, inside that distance set to a fraction relative to the distance.

Otherwise I'd consider a 1D texture drawn across a large disk that gets scaled up over time.

If you're wanting to manually draw it, checking documentation, it looks like they've got drawing functions for DrawCircle() and DrawSolidCircle(). If those don't work, there are also spline drawing tools. That should cover the doughnut, the inside might require some gradient drawing if the API supports.

This topic is closed to new replies.

Advertisement