• Advertisement
Sign in to follow this  

Generate this kind of 2d burst or pulse

This topic is 722 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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^^
 
 
:)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.  

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement