Inherits from CCLayerColor : CCLayerRGBA : CCLayer : CCNode : NSObject
Declared in CCLayer.h

Overview

CCLayerGradient is a subclass of CCLayerColor that draws gradients across the background.

All features from CCLayerColor 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

Properties

compressedInterpolation

Whether or not the interpolation will be compressed in order to display all the colors of the gradient both in canonical and non canonical vectors Default: YES

@property (nonatomic, readwrite) BOOL compressedInterpolation

Declared In

CCLayer.h

endColor

The ending color.

@property (nonatomic, readwrite) ccColor3B endColor

Declared In

CCLayer.h

endOpacity

The ending color.

@property (nonatomic, readwrite) GLubyte endOpacity

Declared In

CCLayer.h

startColor

The starting color.

@property (nonatomic, readwrite) ccColor3B startColor

Declared In

CCLayer.h

startOpacity

The starting opacity.

@property (nonatomic, readwrite) GLubyte startOpacity

Declared In

CCLayer.h

vector

The vector along which to fade color.

@property (nonatomic, readwrite) CGPoint vector

Declared In

CCLayer.h

Class Methods

layerWithColor:fadingTo:

Creates a full-screen CCLayer with a gradient between start and end.

+ (id)layerWithColor:(ccColor4B)start fadingTo:(ccColor4B)end

Declared In

CCLayer.h

layerWithColor:fadingTo:alongVector:

Creates a full-screen CCLayer with a gradient between start and end in the direction of v.

+ (id)layerWithColor:(ccColor4B)start fadingTo:(ccColor4B)end alongVector:(CGPoint)v

Declared In

CCLayer.h

Instance Methods

initWithColor:fadingTo:

Initializes the CCLayer with a gradient between start and end.

- (id)initWithColor:(ccColor4B)start fadingTo:(ccColor4B)end

Declared In

CCLayer.h

initWithColor:fadingTo:alongVector:

Initializes the CCLayer with a gradient between start and end in the direction of v.

- (id)initWithColor:(ccColor4B)start fadingTo:(ccColor4B)end alongVector:(CGPoint)v

Declared In

CCLayer.h