比如一个小人的图片,我想在界面中只显示其身子,看不到头,应该怎么剪裁呢?
使用spriteFrame.setRect这个api
好的!我试试 谢啦
你好 我是对着节点里的sprite进行实时的裁剪操作。可是用了setRect,图片并没有发生变化呢。。 可以帮我看看是什么问题吗?
代码如下:
this.xiaochu1.setRect(cc.rect(Rect_x, Rect_y, Rect_w, Rect_h)); this.reArea2.getComponent(cc.Sprite).spriteFrame = this.xiaochu1;
thia.xiaochu1是一个SpriteFrame对象。this.reArea2是要操作的节点对象。