I do some simple games using SpriteKit now. There is one problem with stroke color in drawing process.
I have to do my colored shapeNode transparent, but my stroke color stays the same every time. I've tried different techniques to do my node be entirely transparent: 1)setting alpha component to stroke color 2)setting alpha component to whole node. It didn't help. Is there is any way to achieve or get around this?
Creation of my node
CGMutablePathRef arc = CGPathCreateMutable();
cardWidth = cardWidth + cardAlpha;
CGPathAddRoundedRect(arc, NULL, CGRectMake(-cardWidth/2, -cardHeight/2, cardWidth, cardHeight), roundRadius, roundRadius);
roundRect = [SKShapeNode node];
roundRect.name = self.name;
CGFloat lineWidth = 2.0;
CGPathRef strokedArc =
CGPathCreateCopyByStrokingPath(arc, NULL,
lineWidth,
kCGLineCapButt,
kCGLineJoinMiter, // the default
10); // 10 is default miter limit
roundRect.path = strokedArc;
[self addChild:roundRect];
Then i try to change color and opacity
roundRect.fillColor = rightColor;
roundRect.strokeColor = rightColor;
roundRect.strokeColor = rightColor;
termLabel.fontColor = rightColor;
roundRect.alpha = 0.5;
I think the problem is with your path. the fill color is covering your stoke so you don't see any change of the stroke color. But with my test, the node.alpha component should work. It maybe the type of iOS version, Apple may change how some things work together.
Here is some code to play with: