Just ask the title asks, I am wondering if this is at all possible. Most examples of the SKCropNode use a texture or a shape. What I want to accomplish is a mask of a custom shape. Let me know if there's a way!
Asked
Active
Viewed 425 times
1
-
What is an SKMaskNode? Do you mean SKCropNode? – Knight0fDragon Oct 30 '16 at 07:48
-
Yes this is what I mean to say, my apologies. Edited. – Lyres Oct 30 '16 at 19:50
-
1ok, you can use any SKNode as your mask, whatever your final results of your mask are, if the alpha < .5 it is cropped (Unless it is another crop node, then you get alpha level cropping, which is handy) – Knight0fDragon Oct 30 '16 at 19:53
-
@Knight0fDragon could you kindly elaborate on what you mean by alpha level cropping? – Crashalot Jun 05 '17 at 23:41
-
1@Crashalot Alpha level cropping means your pixel will only drop to the alpha level of the mask, so if you have a solid white image, and use alpha masking of 75%, then your white image becomes 25% transparent – Knight0fDragon Jun 06 '17 at 12:49
-
@Knight0fDragon thanks! – Crashalot Jun 06 '17 at 19:32
1 Answers
0
You could mask a node by giving it a child node where the child node's zPosition is greater than the parent's. And then, of course, you'd have to position the child node correctly on top of the parent node -but this should be easy as the child node's position is located relative to the parent node (i.e. if parent has position (25, 30) in the scene, and you set child.position = CGPoint(x:5, y:0), the child's position in the scene would be (30, 30)). Also, if the parent node moves, the child node moves with it.

Ralph
- 471
- 5
- 14
-
This is not a mask, this is an overlay. Masks in this case is data used for bitwise operations. E.G. SKCropNodes, any pixel with alpha < 0.5 in a mask is cropped on the given node – Knight0fDragon Oct 30 '16 at 07:50
-
Yes I wish to use a mask using the SKCropNode, not placing a node on top of another. – Lyres Oct 30 '16 at 19:52