skcropnode

SKCropNode fails when I add extra SKNode children in hierarchy

大憨熊 提交于 2020-01-13 10:06:08
问题 Update: It looks like iOS 10 has fixed this issue. I upgraded to Swift 3 and Xcode 8 and everything is working as expected. I've run into this issue a couple times now and I can't tell if it's a bug in SKCropNode or if I'm just misusing it. Perhaps there's some bit of documentation I'm missing to explain why this is happening? I have a crop node with a 100x100 rectangle shape as the mask. If I place a blue circle inside it, it gets cropped properly. // Create a crope node with a small square.

SKCropNode fails when I add extra SKNode children in hierarchy

你离开我真会死。 提交于 2020-01-13 10:05:22
问题 Update: It looks like iOS 10 has fixed this issue. I upgraded to Swift 3 and Xcode 8 and everything is working as expected. I've run into this issue a couple times now and I can't tell if it's a bug in SKCropNode or if I'm just misusing it. Perhaps there's some bit of documentation I'm missing to explain why this is happening? I have a crop node with a 100x100 rectangle shape as the mask. If I place a blue circle inside it, it gets cropped properly. // Create a crope node with a small square.

SKCropNode masking edge anti-aliasing

你。 提交于 2019-12-30 04:06:10
问题 I created a circular mask and animate a sprite inside the mask by using sprite kit SKCropNode class. But the edge of the mask looks pixellated. Is there a way to use anti-aliasing to smooth the edges? 回答1: If you want to mask any SKNode/SKSpriteNode with an anti-aliasing effect - you can use SKEffectNode instead of SKCropNode. It works with animated nodes as well. Here is an example: // Set up your node SKNode *nodeToMask = [SKNode node]; // ... // Set up the mask node SKEffectNode *maskNode

Private Boolean: how to set on SKCropNode, with Swift?

六月ゝ 毕业季﹏ 提交于 2019-12-24 08:12:26
问题 SKCropNode works by removing every thing from its affected nodes that are not covered by its source image. This is one type of masking, the other is to invert this logic, and reveal everything that's not covered by the source image. SKCropNode has a boolean switch to set this state, called invertMask , sensibly enough. What's annoying is that it's seemingly private. If putting aside all the app store approval processes, dangers of private APIs, etc, and accepting that it's something

Swift 3: cut a hole in a SKSpriteNode

我与影子孤独终老i 提交于 2019-12-13 07:32:27
问题 First of all: I know, that this questions has already many answers here, but they didn't helped me to solve this this problem. I program a little game. At the first launch there is a little tutorial, where bit by bit each element of the game is explained. In each step I want to highlight one of these elements. So I put a black SKSpriteNode with an alpha of 0.9 in front of the elements. If an element should be highlighted, the SpriteNode should become transparent at this point. So I made an

Making SKLabelNode as a crop node of SKShapeNode

对着背影说爱祢 提交于 2019-12-08 00:12:14
问题 Can't find in web, how to make SKLabelNode cropping SKShapeNode. When i colorize the background, my goal is colorize the label too with the same method, so both of them have to colorize simultaneously. But can't imagine how to crop SKShapeNode with this label. Help me please! 回答1: But can't imagine how to crop SKShapeNode with this label. If I understand you correctly, you can set SKLabelNode as a mask of a SKCropNode, like this: override func didMoveToView(view: SKView) { backgroundColor =

Animate masked image in SpriteKit (SKCropNode)

我们两清 提交于 2019-12-06 11:26:11
问题 I'm using Sprite Kit to create my first iOS app, and I'm stumbling over what seems to be a pretty basic problem. I'm trying to animate the contents ( fillNode ) of a SKCropNode ( cropNode ). The code below sets up the SKScene just fine (I see the illustration masked correctly, placed over the background image in the right location)... SKSpriteNode *logoBG = [[SKSpriteNode alloc] initWithImageNamed:logoBackground]; logoBG.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self

SKCropNode fails when I add extra SKNode children in hierarchy

两盒软妹~` 提交于 2019-12-05 09:34:47
Update: It looks like iOS 10 has fixed this issue. I upgraded to Swift 3 and Xcode 8 and everything is working as expected. I've run into this issue a couple times now and I can't tell if it's a bug in SKCropNode or if I'm just misusing it. Perhaps there's some bit of documentation I'm missing to explain why this is happening? I have a crop node with a 100x100 rectangle shape as the mask. If I place a blue circle inside it, it gets cropped properly. // Create a crope node with a small square. let cropNode = SKCropNode() let cropNodeMask = SKShapeNode(rect: CGRect(x: 0, y: 0, width: 100, height

Animate masked image in SpriteKit (SKCropNode)

筅森魡賤 提交于 2019-12-04 16:13:55
I'm using Sprite Kit to create my first iOS app, and I'm stumbling over what seems to be a pretty basic problem. I'm trying to animate the contents ( fillNode ) of a SKCropNode ( cropNode ). The code below sets up the SKScene just fine (I see the illustration masked correctly, placed over the background image in the right location)... SKSpriteNode *logoBG = [[SKSpriteNode alloc] initWithImageNamed:logoBackground]; logoBG.position = CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame)); [self addChild:logoBG]; SKCropNode *cropNode = [[SKCropNode alloc] init]; cropNode.maskNode = [

Is it possible to use a circle (SKShapeNode) as a mask in Sprite Kit?

本秂侑毒 提交于 2019-12-03 12:16:48
I'm trying to create a circular mask in a Sprite Kit project. I create the circle like this (positioning it at the centre of the screen): SKCropNode *cropNode = [[SKCropNode alloc] init]; SKShapeNode *circleMask = [[SKShapeNode alloc ]init]; CGMutablePathRef circle = CGPathCreateMutable(); CGPathAddArc(circle, NULL, CGRectGetMidX(self.frame), CGRectGetMidY(self.frame), 50, 0, M_PI*2, YES); circleMask.path = circle; circleMask.lineWidth = 0; circleMask.fillColor = [SKColor blueColor]; circleMask.name=@"circleMask"; and further down the code, I set it as the mask for the cropNode : [cropNode