代码:
var self = this;
this._light = new cc.Sprite("res/s.png");
var enemy = new cc.Sprite();
var dh = sp.SkeletonAnimation.create("res/robot/enemy.json","res/robot/enemy.atlas");
dh.setAnimation(0,"idle",true);
self._light.anchorY = 0;
self._light.scaleX = 8;
self._light.scaleY = 8;
var clipNode = new cc.ClippingNode();
clipNode.setStencil(dh);
clipNode.setPositionX(300);
clipNode.setPositionY(0);
clipNode.setInverted(false);
clipNode.setAlphaThreshold(0.1);
clipNode.name = "clipNode";
clipNode.addChild(dh);
clipNode.addChild(this._light);
this.addChild(clipNode);
模拟器效果图:
真机效果图:

