engine
CocosCreator v2.x
Mask
Mask for defining renderable range child node, the node will use the assembly with a Mask the node's bounding box (i.e. range Size property inspector Node predetermined assembly) to create a rendering mask, all the child nodes node will be tailored according to the mask, the mask will not be rendered outside the range.
Levels
We look shield assembly here, pay attention to the node size Size
the Shape of any of the pictures you can do will make a variety of effects.
Pictures given:
(bad eyes can not see, I did the shape upload pictures)
script
Rotating script is simple, turn the parent node, child node reverse turn, ensures the child node does not move.
cc.Class({
extends: cc.Component,
properties: {
mask: cc.Node
},
onLoad () {
this.rotation = 0;
this.speed = 100;
},
update (dt) {
this.rotation += this.speed * dt;
if (this.rotation > 360) this.rotation = 0;
this.mask.rotation = this.rotation;
this.mask.children[0].rotation = -this.rotation;
},
});
effect
O (∩_∩) O ~~
How kind, simple!
Add my blog :( QQ group inside the project, the group has a file oh)
706176551
we study together!