Documentation
¶
Index ¶
- Variables
- type Assets
- type Circle
- type Circular
- type Drawer
- type EmissionShape
- type Parser
- type Point
- type RawStyle
- func (r RawStyle) ColorGen(key string, custom map[string]lerpc.Generator, def lerpc.Generator) (e lerpc.Generator)
- func (r RawStyle) ColorTween(key string, custom map[string]lerpc.Tween, def lerpc.Tween) (e lerpc.Tween)
- func (r RawStyle) Drawer(key string, custom map[string]Drawer, def Drawer) (e Drawer)
- func (r RawStyle) EmissionShape(key string, custom map[string]EmissionShape, def EmissionShape) (e EmissionShape)
- func (r RawStyle) FloatGen(key string, custom map[string]lerp.Generator, def lerp.Generator) (e lerp.Generator)
- func (r RawStyle) FloatTween(key string, custom map[string]lerp.Tween, def lerp.Tween) (e lerp.Tween)
- type Rectangle
- type Request
- type Sprite
- type System
- type Thread
- type Type
Constants ¶
This section is empty.
Variables ¶
var DefType = Type{ EmissionShape: Point{}, Color: lerpc.Const(mat.White), Mask: lerpc.Const(mat.White), ScaleMultiplier: lerp.Const(1), Acceleration: lerp.Const(0), TwerkAcceleration: lerp.Const(0), Velocity: lerp.Const(0), Livetime: lerp.Const(1), Rotation: lerp.Const(0), Spread: lerp.Const(0), ScaleX: lerp.Const(1), ScaleY: lerp.Const(1), Gravity: mat.V(0, -300), // contains filtered or unexported fields }
DefType contains default configuration ro Type
Functions ¶
This section is empty.
Types ¶
type Assets ¶
type Assets struct { ColorTweens map[string]lerpc.Tween ColorGenerators map[string]lerpc.Generator FloatTweens map[string]lerp.Tween FloatGenerators map[string]lerp.Generator Drawers map[string]Drawer EmissionShapes map[string]EmissionShape }
Assets can contain custom Objects that Parser uses to load the Type
type Circular ¶
type Circular struct {
Radius, Spread float64
}
Circular spawns particles in specified arc, possibly circle
type Drawer ¶
Drawer is a particle drawer, core is a ggl.Drawer but it also has to be able to copy it self and provide how math indices and vertexes one draw takes
type EmissionShape ¶
EmissionShape is a vector generator, usefull for particle system (determining particle spawn position)
type Parser ¶
Parser performs parsing of goss into particle Tapes
type Point ¶
type Point struct{}
Point is most basic emission shape, all particles will get spawned o a same position
type RawStyle ¶
RawStyle extends load.Rawstile by particle specific functionality
func (RawStyle) ColorGen ¶
func (r RawStyle) ColorGen(key string, custom map[string]lerpc.Generator, def lerpc.Generator) (e lerpc.Generator)
ColorGen parses a color generator, syntax documented on RawStyle.color method applies
func (RawStyle) ColorTween ¶
func (r RawStyle) ColorTween(key string, custom map[string]lerpc.Tween, def lerpc.Tween) (e lerpc.Tween)
ColorTween parses a color tween, syntax documented on RawStyle.color method applies
func (RawStyle) Drawer ¶
Drawer parses drawer under the key, if parsing fails, def is returned
syntax:
circle radius outline resolution - if you prefix property with 'circle' and provide two numbers
circular drawer will be used
rect width height - if you prefix property with 'rect' and provide 2 values, rectangle drawer
will be used
name - providing neather rect nor circle prefix, custom drawer will be searched
func (RawStyle) EmissionShape ¶
func (r RawStyle) EmissionShape(key string, custom map[string]EmissionShape, def EmissionShape) (e EmissionShape)
EmissionShape parses emission shape under given key, if parsing fails def is returned
syntax:
circle radius spread - if you prefix property with 'circle' and provide two numbers
circular shape will be used, if you omit second value, circle will fall back to default (math.Pi)
rect width height - if you prefix property with 'rect' and provide 2 values, rectangle shape
will be used, if you omit height, width is used for both dimension
name - if you provide neither rect nor circle prefix, custom shape will be searched
func (RawStyle) FloatGen ¶
func (r RawStyle) FloatGen(key string, custom map[string]lerp.Generator, def lerp.Generator) (e lerp.Generator)
FloatGen returns float generator, returns def if process failed
syntax:
number - returns lerp.Constant(number) random number number - if you prefix field with 'random' and provide two numbers lerp.Random(number, number)
is returned
name - if name is not equal random it will search for custom generator with this name
func (RawStyle) FloatTween ¶
func (r RawStyle) FloatTween(key string, custom map[string]lerp.Tween, def lerp.Tween) (e lerp.Tween)
FloatTween returns float tween, returns def if process failed
syntax:
number - returns lerp.Constant(number) linear start end - if you prefix field with 'linear' and provide two numbers lerp.Linear(number, number)
is returned
bezier start startHandle endHandle end - if you prefix field with 'bezier' and provide four numbers
lerp.Bezier(start, startHandle, endHandle, end) is returned
name - if name is not equal 'random' of 'bezier' it will search for custom tween with this name
type Rectangle ¶
type Rectangle struct {
Width, Height float64
}
Rectangle spans particles in a rectangle area
type System ¶
System is a particle renderer and updater. Its designed to be updated from multiple threads, and also to spawn particles off thread. System has its own goroutine that is reused for spawning so Drop is necessary to prevent a memory leak
func (*System) RunSpawner ¶
func (s *System) RunSpawner()
RunSpawner spawns all spawn requests on separate thread
func (*System) SetThreads ¶
SetThreads sets the thread count the System is targetting
type Thread ¶
type Thread struct { *System // contains filtered or unexported fields }
Thread collects requests and updates its fraction of particles
type Type ¶
type Type struct { EmissionShape Color lerpc.Tween Mask lerpc.Generator ScaleMultiplier, Acceleration, TwerkAcceleration lerp.Tween Velocity, Livetime, Twerk, Rotation, Spread, ScaleX, ScaleY lerp.Generator Friction, OriginGravity float64 Gravity mat.Vec RotationRelativeToVelocity bool // contains filtered or unexported fields }
Type defines behavior of a particles