cocos2d-iphone  1.0.1
Improved Cocos2D API Reference (iOS version) for Kobold2D developers
CCLayerGradient Interface Reference

#include <CCLayer.h>

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

List of all members.

Public Member Functions

id initWithColor:fadingTo: (ccColor4B start,[fadingTo] ccColor4B end)
id initWithColor:fadingTo:alongVector: (ccColor4B start,[fadingTo] ccColor4B end,[alongVector] CGPoint v)

Static Public Member Functions

id layerWithColor:fadingTo: (ccColor4B start,[fadingTo] ccColor4B end)
id layerWithColor:fadingTo:alongVector: (ccColor4B start,[fadingTo] ccColor4B end,[alongVector] CGPoint v)

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 CCLayerGradient::initWithColor:fadingTo: ( ccColor4B  start,
[fadingTo] ccColor4B  end 
) [virtual]

Initializes the CCLayer with a gradient between start and end.

id CCLayerGradient::initWithColor:fadingTo:alongVector: ( ccColor4B  start,
[fadingTo] ccColor4B  end,
[alongVector] CGPoint  v 
) [virtual]

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

id CCLayerGradient::layerWithColor:fadingTo: ( ccColor4B  start,
[fadingTo] ccColor4B  end 
) [static, virtual]

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

id CCLayerGradient::layerWithColor:fadingTo:alongVector: ( ccColor4B  start,
[fadingTo] ccColor4B  end,
[alongVector] CGPoint  v 
) [static, virtual]

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


Property Documentation

BOOL CCLayerGradient::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 CCLayerGradient::endColor [read, write, assign]

The ending color.

GLubyte CCLayerGradient::endOpacity [read, write, assign]

The ending color.

ccColor3B CCLayerGradient::startColor [read, write, assign]

The starting color.

GLubyte CCLayerGradient::startOpacity [read, write, assign]

The starting opacity.

CGPoint CCLayerGradient::vector [read, write, assign]

The vector along which to fade color.


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