CCNodeGradient Class Reference
| Inherits from | CCNodeColor : CCNode : CCResponder : NSObject |
|---|---|
| Declared in | CCNodeColor.h |
Overview
Draws a rectangle filled with a gradient.
The gradient node adds the following properties to the ones already provided by CCNodeColor:
- vector (direction)
- startColor and endColor (gradient colors)
If no vector is supplied, it defaults to (0, -1) - fading from top to bottom. Color is interpolated between the startColor and endColor along the given vector (starting at the origin, ending at the terminus).
Creating a Gradient Node
+ nodeWithColor:fadingTo:alongVector:
Creates a full-screen CCNode with a gradient between start and end color values with gradient direction vector.
+ (instancetype)nodeWithColor:(CCColor *)start fadingTo:(CCColor *)end alongVector:(CGPoint)vParameters
start |
Start color. |
|---|---|
end |
End color. |
v |
Direction vector for gradient. |
Return Value
The CCNodeGradient Object.
See Also
Declared In
CCNodeColor.h
– initWithColor:fadingTo:alongVector:
Creates a full-screen CCNode with a gradient between start and end color values with gradient direction vector.
- (id)initWithColor:(CCColor *)start fadingTo:(CCColor *)end alongVector:(CGPoint)vParameters
start |
Start color. |
|---|---|
end |
End color. |
v |
Direction vector for gradient. |
Return Value
An initialized CCNodeGradient Object.
See Also
Declared In
CCNodeColor.h
Gradient Color and Opacity
startColor
The starting color.
@property (nonatomic, strong) CCColor *startColorSee Also
Declared In
CCNodeColor.h
endColor
The ending color.
@property (nonatomic, strong) CCColor *endColorSee Also
Declared In
CCNodeColor.h
startOpacity
The start color’s opacity.
@property (nonatomic, readwrite) CGFloat startOpacityDeclared In
CCNodeColor.h
endOpacity
The end color’s opacity.
@property (nonatomic, readwrite) CGFloat endOpacityDeclared In
CCNodeColor.h
Gradient Direction
vector
The vector that determines the gradient’s direction. Defaults to {0, -1}.
@property (nonatomic, readwrite) CGPoint vectorDeclared In
CCNodeColor.h