cocos2d-iphone  2.1
Improved Cocos2D API Reference (iOS version) for www.kobold2d.com developers
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Defines
CCLayerGradient Class Reference

#import <CCLayer.h>

+ Inheritance diagram for CCLayerGradient:
+ Collaboration diagram for CCLayerGradient:

List of all members.

Public Member Functions

(id) - initWithColor:fadingTo:
(id) - initWithColor:fadingTo:alongVector:

Static Public Member Functions

(id) + layerWithColor:fadingTo:
(id) + layerWithColor:fadingTo:alongVector:

Protected Attributes

GLubyte _startOpacity
GLubyte _endOpacity
CGPoint _vector
BOOL _compressedInterpolation

Properties

ccColor3B _endColor
ccColor3B startColor
ccColor3B endColor
GLubyte startOpacity
GLubyte endOpacity
CGPoint vector
BOOL compressedInterpolation

Detailed Description

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.

Since:
v0.99.5

Member Function Documentation

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

Initializes the CCLayer with a gradient between start and end.

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

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

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

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

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

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


Property Documentation

- (BOOL) compressedInterpolation [read, write, assign]

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

- (ccColor3B) endColor [read, write, assign]

The ending color.

- (GLubyte) endOpacity [read, write, assign]

The ending color.

- (ccColor3B) startColor [read, write, assign]

The starting color.

- (GLubyte) startOpacity [read, write, assign]

The starting opacity.

- (CGPoint) vector [read, write, assign]

The vector along which to fade color.


The documentation for this class was generated from the following file: