4
\$\begingroup\$

I 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..

https://www.youtube.com/watch?v=ewnEE5mt1ZM

\$\endgroup\$
  • 2
    \$\begingroup\$ This is simply a circle of radius R with a circle of radius R - C removed from its center. R = Outer Radius, C = Ring Thickness. \$\endgroup\$ – MickLH Apr 28 '16 at 18:35
-2
\$\begingroup\$

This code is adapted from a game demo in 'Cocos2d-x by Example Beginner's Guide' by Roger Engelbert.

circleSprite->setScale(0.1f);
circleSprite->runAction(ScaleTo::create(1.0f, 5.0f));

First it makes the sprite tiny (0.1f) and then runs an action to scale it up over 1.0 second (I have used an arbitrary scale to value of 5.0f for this example).

The circle sprite is just an image of a thick circle outline with the middle and outside transparent.

HTH

\$\endgroup\$
  • 2
    \$\begingroup\$ Did you read the question thoroughly? It specifically says that "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.." \$\endgroup\$ – Kromster says support Monica May 23 '16 at 4:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.