animator.graphics.shader.Shader

class animator.graphics.shader.Shader(sksl: str)

Bases: object

__init__(sksl: str) None

Create a shader from the given sksl code. If the sksl code is invalid, a ValueError will be raised.

Parameters

sksl – The sksl code for the shader.

Methods

__init__(sksl)

Create a shader from the given sksl code.

build()

Build the shader.

from_file(path)

Create a shader from the given file path.

get_child(name)

Get the child with the given name.

get_uniform(name)

Get the uniform with the given name.

Attributes

builder

The shader's builder, useful for building runtime shader image filters.

children_names

Names of the shader's children.

uniform_names

Names of the shader's uniforms.

build() animator.skia.Shader

Build the shader.

property builder: animator.skia.RuntimeShaderBuilder

The shader’s builder, useful for building runtime shader image filters.

property children_names: set[str]

Names of the shader’s children.

classmethod from_file(path: str) animator.graphics.shader.Shader

Create a shader from the given file path.

get_child(name: str) animator.skia.RuntimeEffectBuilder.BuilderChild

Get the child with the given name. Call skia.RuntimeEffectBuilder.BuilderChild.set() on the returned object to set the child’s value.

get_uniform(name: str) animator.skia.RuntimeEffectBuilder.BuilderUniform

Get the uniform with the given name. Call skia.RuntimeEffectBuilder.BuilderUniform.set() on the returned object to set the uniform’s value.

property uniform_names: set[str]

Names of the shader’s uniforms.