Croping a CCSprite


Hi, I’ve been trying to draw a VU meter using sprites and I’m in a slump. The VU should contain two sprites which overlap: a background (with no indication, attachment 1) and a full lightened pic (attachment 2). Once a new value is processed and should be displayed I want to create a “destination” sprite where only a part of the full VU is overlapped with the background (attachment 3). My question is how can I crop the full sprite to certain height and form a third sprite with the background and the cropped one? Thanks for your help and sorry for my bad English.

1.png (29.9 KB)


You may want to take a look at CCProgressTimer or you can try setting a clipping area with glScissor before drawing the sprite.