Is there a fine way to do this programatically?
Can someone help and point me to the right doc / direction?
Hi ! You can use ClippingNode !
There is no such thing.
I am using Cocos Creator 2.0.9 and 2.1.1. I really need to cut down images…
Why not use a Mask?
Because I need to cut texture dynamically in multiple places and cut it into multiple sprite frames. The mask cannot do that
RenderTexture
can be used in many ways to achieve this concept
Create object with size you want, render whatever you want inside the object, use the getSprite
method.
Thank you. I will try. Is it available on 2.0.9 and 2.1.1?
I dont have a getSprite method inside the RenderTexture…
Found Solution! At last…
RenderTexture class did not help at all. So after lots of diggings I found out that I can create a SpriteFrame with specific texture and load it with a given rectangle that actually crops the image.
const spriteFrame = new cc.SpriteFrame(myTexture, new cc.Rect(0, 0, 50, 50));
The code above did the trick!
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.