CPShimmerShader

class CPShimmerShader(entireFrame: Boolean, colors: Seq[CPColor], keyFrame: Int, autoStart: Boolean, skip: (CPZPixel, Int, Int) => Boolean, durMs: Long, onDuration: CPSceneObjectContext => Unit) extends CPShader

Color shimmer shader.

This shader provides color shimmer effect for the entire camera frame or the individual scene object it is attached to. Shimmering consists of randomly changing a color of the pixel for a small period of time. If used for entire camera frame effect it can be attached to an off-screen sprite. Note that unlike CPSparkleShader that provides similar effect but with gradual dimming and brightening of color, the shimmer effect employs random color selection from the given set of colors.

Value parameters:
autoStart

Whether to start shader right away. Default value is false.

colors

Sequence of colors to use for shimmering effect. Colors will be selected randomly from this set.

durMs

Duration of the effect in milliseconds. By default, the effect will go forever.

entireFrame

Whether apply to the entire camera frame or just the object this shader is attached to.

keyFrame

nth-frame to render the effect. For example, if key frame is 5 than the colors will change on each 5th frame and remain the same on all subsequent frames until next key frame is reached.

onDuration

Optional callback to call when this shader finishes by exceeding the duration specified by durMs parameter. Default is a no-op.

skip

Predicate allowing to skip certain pixel from the shader. Predicate takes a pixel (with its Z-order), and X and Y-coordinate of that pixel. Note that XY-coordinates are always in relation to the entire canvas. Typically used to skip background or certain Z-index. Default predicate returns false for all pixels.

See also:
Example:

See CPShaderExample class for the example of using shaders.

Source:
CPShimmerShader.scala
trait CPShader
trait CPAsset
class Object
trait Matchable
class Any

Type members

Classlikes

case class PixelXYZ(px: CPPixel, x: Int, y: Int, z: Int)

Value members

Concrete methods

def isOn: Boolean

Tests whether this shader is in progress or not.

Tests whether this shader is in progress or not.

Source:
CPShimmerShader.scala
override def render(ctx: CPSceneObjectContext, objRect: CPRect, inCamera: Boolean): Unit

Called on each frame pass on scene object that has this shaders attached to it. This callback is called regardless of whether or not the scene object is visible or in camera frame.

Called on each frame pass on scene object that has this shaders attached to it. This callback is called regardless of whether or not the scene object is visible or in camera frame.

Definition Classes
Source:
CPShimmerShader.scala
def start(): Unit

Starts the shader effect.

Starts the shader effect.

See also:
Source:
CPShimmerShader.scala
def stop(): Unit

Stops the shader effect without waiting for the duration. Note that onDuration() callback will not be called in this case.

Stops the shader effect without waiting for the duration. Note that onDuration() callback will not be called in this case.

See also:
Source:
CPShimmerShader.scala
def toggle(): Unit

Toggles this shader effect on and off by calling either start or stop methods..

Toggles this shader effect on and off by calling either start or stop methods..

See also:
Source:
CPShimmerShader.scala

Inherited fields

override val getOrigin: String

Gets the origin of this asset. Typically, this should be a URL, file name or class name for in-code assets like array images, animations or system font.

Gets the origin of this asset. Typically, this should be a URL, file name or class name for in-code assets like array images, animations or system font.

Inherited from:
CPShader
Source:
CPShader.scala