CCNodeGradient Class Reference
| Inherits from | CCNodeColor : CCNode : CCResponder : NSObject |
| Declared in | CCNodeColor.h |
Overview
CCNodeGradient is a subclass of CCNodeColor that draws gradients across the background.
All features from CCNodeColor are valid, plus the following new features: - direction - final color - interpolation mode
Color is interpolated between the startColor and endColor along the given vector (starting at the origin, ending at the terminus).
If no vector is supplied, it defaults to (0, -1) – a fade from top to bottom.
If ‘compressedInterpolation’ is disabled, you will not see either the start or end color for non-cardinal vectors; a smooth gradient implying both end points will be still be drawn, however.
If ‘ compressedInterpolation’ is enabled (default mode) you will see both the start and end colors of the gradient.
Tasks
Creating a CCNodeGradient Object
Initializing a CCNodeGradient Object
Accessing CCNodeGradient Attributes
-
startColorproperty -
endColorproperty -
startOpacityproperty -
endOpacityproperty -
vectorproperty -
compressedInterpolationproperty
Properties
compressedInterpolation
Deprecated in 3.1. All colors are correctly displayed across the node's rectangle.
Default: YES.
@property (nonatomic, readwrite) BOOL compressedInterpolationDeclared In
CCNodeColor.hendColor
The ending color.
@property (nonatomic, strong) CCColor *endColorDeclared In
CCNodeColor.hendOpacity
The ending color.
@property (nonatomic, readwrite) CGFloat endOpacityDeclared In
CCNodeColor.hstartColor
The starting color.
@property (nonatomic, strong) CCColor *startColorDeclared In
CCNodeColor.hClass Methods
nodeWithColor:fadingTo:
Creates a full-screen CCNode with a gradient between start and end color values.
+ (id)nodeWithColor:(CCColor *)start fadingTo:(CCColor *)endParameters
- start
Start color.
- end
End color.
Return Value
The CCNodeGradient Object.
Declared In
CCNodeColor.hInstance Methods
initWithColor:fadingTo:
Initializes a full-screen CCNode with a gradient between start and end color values.
- (id)initWithColor:(CCColor *)start fadingTo:(CCColor *)endParameters
- start
Start color.
- end
End color.
Return Value
An initialized CCNodeGradient Object.
Declared In
CCNodeColor.hinitWithColor: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)vReturn Value
An initialized CCNodeGradient Object.
Declared In
CCNodeColor.h