CPFlashlightShader

class CPFlashlightShader(radius: Int, autoStart: Boolean, skip: (CPZPixel, Int, Int) => Boolean) extends CPShader

Circular flashlight effect shader.

This shader can be used to create a circular flashlight effect around the object. It renders its effect only for a scene object this shader is attached to (i.e. it does not work for entire screen).

Value parameters:
autoStart

Whether or not to toggle on the shader effect automatically. Default value is false.

radius

Radius of circular flashlight effect.

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:
CPFlashlightShader.scala
trait CPShader
trait CPAsset
class Object
trait Matchable
class Any

Value members

Concrete methods

def isActive: Boolean

Returns true if this shader effect is on, false otherwise.

Returns true if this shader effect is on, false otherwise.

Source:
CPFlashlightShader.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:
CPFlashlightShader.scala
def start(): Unit

Starts the shader effect.

Starts the shader effect.

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

Stops the shader effect.

Stops the shader effect.

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

Toggles this shader effect on and off.

Toggles this shader effect on and off.

See also:
Source:
CPFlashlightShader.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