lerpc

package
v0.4.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainedTween

type ChainedTween []TweenPoint

ChainedTween allows linear interpolation between multiple colors Simple resulting color will be interpolation between that two points that contain t, interpolation is of corse relative and smooth

func Chained

func Chained(tps ...TweenPoint) ChainedTween

Chained is ChainedTween constructor

func (ChainedTween) Value

func (c ChainedTween) Value(t float64) mat.RGBA

Value implements Tween interface

if t < then position of first color, first color will be returned if t > then last color position, last color will be returned

type ConstantTween

type ConstantTween mat.RGBA

ConstantTween is wrapper around mat.RGBA that implements Gradient, but it does nothing with the value

func Const

func Const(value mat.RGBA) ConstantTween

Const is ConstantTween constructor

func (ConstantTween) Gen

func (r ConstantTween) Gen() mat.RGBA

Gen implements Generator interface

func (ConstantTween) Value

func (r ConstantTween) Value(t float64) mat.RGBA

Value implements Gradient interface

type Generator

type Generator interface {
	Gen() mat.RGBA
}

Generator should generate a value

type LinearTween

type LinearTween struct {
	A, B mat.RGBA
}

LinearTween supports linear interpolation between two colors encapsulated in struct for interface reasons

func Linear

func Linear(a, b mat.RGBA) LinearTween

Linear is LinearTween constructor

func (LinearTween) Value

func (c LinearTween) Value(t float64) mat.RGBA

Value implements Tween interface

type RandomGenerator

type RandomGenerator struct {
	Min, Max mat.RGBA
}

RandomGenerator generates random color in range between two colors

func Random

func Random(min, max mat.RGBA) RandomGenerator

Random is RandomGenerator constructor

func (RandomGenerator) Gen

func (r RandomGenerator) Gen() mat.RGBA

Gen implements generator interface

type Tween

type Tween interface {
	Value(t float64) mat.RGBA
}

Tween is something that returns color based of t, alike tween is used for interpolation, just with colors

type TweenPoint

type TweenPoint struct {
	Position float64
	Color    mat.RGBA
}

TweenPoint ...

func Point

func Point(position float64, color mat.RGBA) TweenPoint

Point is TweenPoint constructor

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL