cocos2d-js draw circle not instantly

545 views Asked by At

I am wondering how to draw circles (or probably other shapes also) not instantly.

So far I tried drawCircle(args...) in CCDrawNode.js and also the drawCircle(args...) in cc.DrawingPrimitiveCanvas class, and they do draw circles by popping it out instantly on screen.

What if I want to achieve an effect like a circular progressive bar, which completes the circle based on percentage of initialization? Or more generally, what if I want to draw a circle with respect to a prolonged period? I am thinking there is probably a drawCircle function with elapsed time argument but fail to find any. Or do I have to implement my own?

Thanks for any suggestions, so far I am out of ideas.

2

There are 2 answers

0
yasuharu519 On

I think you have to implement by your own. I think you can achieve that update circle drawing on each time update() function is called.

0
Pan D On

For a circular progress bar you can use a cc.ProgressTimer with type set to cc.ProgressTimer.TYPE_RADIAL.

Refer to ProgressActionsTest.js in the js-tests sample project that comes with cocos2d-js v3.

Or see it in action here - http://cocos2d-x.org/js-tests/