Reset color property of SKSpriteNode? - ios

What's the default color value of SKSpriteNode?
It's not mentioned in the Apple docs, and comparing the default property to nil or UIColor.white returns false, suggesting it's neither of these.
The goal is to reset a node's color to the default value after running a SKAction.colorize animation on it.

Setting colorBlendFactor to 0 causes the color property to get ignored.
The value must be a number between 0.0 and 1.0, inclusive. The default
value (0.0) indicates the color property is ignored and that the
texture’s values should be used unmodified. For values greater than
0.0, the texture is blended with the color before being drawn to the scene.
This option solves the problem, but doesn't answer the question of the default color value.
Hopefully someone else posts a definitive answer to the question.

Related

Creating a transparent color within a string palette

I am working within Google Earth Engine and am trying to create a no-color/completely transparent color (no boarder and no fill). Below is a line of code where the first color should be the transparent "color". Basically I want my min value to not show up in the map at all.
Map.addLayer(image, {min: 0, max: 3, palette: [transparent, '#0571b0', '#FFDF00', '#ca0020']},'image');
I have tried creating a variable to set a color as completely transparent (change the opacity to 0), but the palette command cannot take variables. Only strings. I've also read SVG fill color transparency, but do not understand how to change the opacity of that specific color without creating a variable (which again, palette doesn't allow). Lastly, I tried adding 00 to the end of another color, but that did not work either.
Any suggestions?
Update:
I was never able to find a solution to this and ended up just going with a white back ground. It was purely for a nicer aesthetic look to allow a basemap to be seen. If I ever come across a solution, I'll be sure to post it.
I had the same question. I found the solution in the developer group.
See the answers: https://groups.google.com/g/google-earth-engine-developers/c/WcxtEIzudxw/m/GscOlsQhDgAJ
The Solution:
// create your previous mask
image = image.eq(1)
// mask and set the opacity
image = image.mask(image.mask().where(image.eq(0),0.0))

SpriteKit linearDamping - maximum?

Note that Apple's doco asserts
https://developer.apple.com/documentation/spritekit/skphysicsbody/1519796-lineardamping
This property is used to simulate fluid or air friction forces on the body. The property must be a value between 0.0 and 1.0. The default value is 0.1. If the value is 0.0, no linear damping is applied to the object.
In fact: you can set values higher than one - so, "10.0" and "20.0" work perfectly; 1, 10 and 20 are all very clearly different.
has anyone probed in to this and discovered if there is actually a maximum? (If it just asymptotes away, what's the realistic range?)
The Apple doco is simply wrong.
Just to answer my own question, in iOS:
The actual documentation:
This property is used to simulate fluid or air friction forces on the body. The property must be a value between 0.0 and 1.0. The default value is 0.1. If the value is 0.0, no linear damping is applied to the object.
is simply wrong.
A value of about 10 to 15 is typical when you want typical "strong damping" like in many physics scenes.
I very often use values of 2 or 3. And "10" is our value for "very thick honey".

Zeroing channels of cut out area

I imagine there is probably going to be an easy solution for this in GIMP, but I for the life of me can't figure it out.
I'm using the color picker tool with the use info window selected to verify pixel values.
Basically, I have some pixels in an image that I need to zero out. By that I mean I want the RGBA values to all be set to 0.
I attempted to:
use the rectangular select tool to select the group of pixels
use bucket fill to set the pixels to black with opacity set to 0.0
Then, to verify it was done correctly, I use the color picker to test the value of the rectangle I just filled.
Unfortunately, it seems to just contain the previous value. What am I missing here?
The "opacity" of the bucket-fill is the opacity of the paint, not the opacity of the resulting pixels. In other words the less opaque it is, the less visible the result. What you want to do is bucket-fill selection with black, then [delete].

Applying custom color on HighCharts?

I'm working on highcharts , can anyone tell how to change color of points on the line graph ? by default it gives blue color for first , maron for second n so on. but i want to aaply custom colors. is there any function to change color manually ?
You can change line color of graph by setting lineColor property. By default the line takes the color of the series from global configuration array of colors. Check this link for global array of colors. http://api.highcharts.com/highcharts#colors
For setting lineColor separately check this :
http://api.highcharts.com/highcharts#plotOptions.area.lineColor

How can I make a CAEmitterCell fade out at the end of its lifetime?

I'm animating some particles and rather than have then just disappear at the end of their lifetime I'd like them to fade out.
I have a CAEmitterCell defined with a lifetime of 35.0. I don't want to just have the particle fade out over the full duration of the particle lifetime. I only want it to fade out at the end. Perhaps the last 2 or 3 seconds.
For the CAEmitterCell's color property, set the alpha value to lifetime * alphaSpeed (where alphaSpeed is -1.0/fadeOutDuration).
So for a lifetime of 35.0 and a fadeOutDuration of 2.0, alphaSpeed would be -0.5, and alpha would be 17.5.
There are a couple caveats:
This only works if your cells are supposed to start at full alpha.
You'll have to set CAEmitterCell's color property using a CGColorRef created with CGColorCreateCopyWithAlpha. Both UIColor and CGColorCreate clamp their values to a maximum of 1.0. For whatever reason, CGColorCreateCopyWithAlpha doesn't.
Just came across this in the docs which might point in the right direction:
name
The name of the cell.
#property(copy) NSString *name
Discussion
The cell name is used when constructing animation key paths that reference the cell. Defaults to nil.
For example, adding an animation to a cell’s enclosing layer with the a keypath such as emitterCells.myCellName.redRange would animate the redRange propery of the cell in the layer’s emitterCells array with the name myCellName.
Availability
Available in Mac OS X v10.6 and later.
Declared In
CAEmitterCell.h
I gather you still add the animation to the layer but with a key path that references a part of that layer - in this case the cell's property. Is there an alpha property exposed for cells?

Resources