Sign in to follow this  
snrnsi1234

Generate this kind of 2d burst or pulse

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^^
 
https://www.youtube.com/watch?v=ewnEE5mt1ZM
 
:)

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this