Documentation
¶
Overview ¶
Package dust is a particle simulator
Package dust is a particle simulator ¶
Package dust is a particle simulator
Index ¶
- func RandomConfig(d *Dust)
- type Bin
- func (b *Bin) Add(d *Dust)
- func (b *Bin) AddPoint(p *geom.Point)
- func (b *Bin) AddPoints(points geom.PointList)
- func (b *Bin) AddXY(x, y float64)
- func (b *Bin) Bounce(x, y, w, h float64)
- func (b *Bin) BounceCircle(x, y, radius, bounce float64)
- func (b *Bin) Count() int
- func (b *Bin) Cull(x, y, w, h float64)
- func (b *Bin) CullByAge(age int)
- func (b *Bin) Fade(age, fadeTime int)
- func (b *Bin) First() *Dust
- func (b *Bin) Get(i int) *Dust
- func (b *Bin) GravitateTo(x, y, gravity float64)
- func (b *Bin) GravitateToDust(part *Dust, gravity float64)
- func (b *Bin) GravitateToPoint(point *geom.Point, gravity float64)
- func (b *Bin) Gravity(g float64)
- func (b *Bin) Last() *Dust
- func (b *Bin) Points() geom.PointList
- func (b *Bin) RandomizeVelocity(min, max float64)
- func (b *Bin) Remove(d *Dust)
- func (b *Bin) RepelFrom(x, y, radius, k float64)
- func (b *Bin) SetBounce(bounce float64)
- func (b *Bin) SetDamp(damp float64)
- func (b *Bin) SetMaxVelocity(vel float64)
- func (b *Bin) SpringTo(x, y, k float64)
- func (b *Bin) SpringToDust(part *Dust, k float64)
- func (b *Bin) SpringToPoint(point *geom.Point, k float64)
- func (b *Bin) SpringToRadius(x, y, radius, k float64)
- func (b *Bin) Update()
- func (b *Bin) Wander(w float64)
- func (b *Bin) Wrap(x, y, w, h float64)
- type ConfigFunc
- type Dust
- func (d *Dust) AddVelocity(vx, vy float64)
- func (d *Dust) BounceCircle(x, y, radius, bounce float64) bool
- func (d *Dust) GravitateTo(x, y, gravity float64)
- func (d *Dust) GravitateToDust(part *Dust, gravity float64)
- func (d *Dust) GravitateToPoint(point *geom.Point, gravity float64)
- func (d *Dust) Heading() float64
- func (d *Dust) Point() *geom.Point
- func (d *Dust) Pos() (float64, float64)
- func (d *Dust) RepelFrom(x, y, radius, k float64)
- func (d *Dust) SetHeading(angle float64)
- func (d *Dust) SetRandomVelocity(min, max float64)
- func (d *Dust) SetVelocityHeading(vel, heading float64)
- func (d *Dust) SetVelocityXY(vx, vy float64)
- func (d *Dust) SpringTo(x, y, k float64)
- func (d *Dust) SpringToDust(part *Dust, gravity float64)
- func (d *Dust) SpringToPoint(point *geom.Point, gravity float64)
- func (d *Dust) SpringToRadius(x, y, radius, k float64)
- func (d *Dust) String() string
- func (d *Dust) Update()
- func (d *Dust) Velocity() float64
- func (d *Dust) Wander(w float64)
- type Emitter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomConfig ¶
func RandomConfig(d *Dust)
RandomConfig is a config that give a new particle a random velocity.
Types ¶
type Bin ¶
type Bin struct {
List []*Dust
// contains filtered or unexported fields
}
Bin is a list of particles.
func NewBinFromPointList ¶
NewBinFromPointList creates a bin of particles based on a point list.
func (*Bin) BounceCircle ¶
BounceCircle causes all particles in this bin to bounce off the specified circle.
func (*Bin) CullByAge ¶
CullByAge removes any points that have been updated more than a given number of times.
func (*Bin) Fade ¶
Fade removes any points that have been updated more than a given number of times.
func (*Bin) GravitateTo ¶
GravitateTo pulls all the particles in this bin to the given x, y point.
func (*Bin) GravitateToDust ¶
GravitateToDust pulls all the particles in this bin to the given dust particle.
func (*Bin) GravitateToPoint ¶
GravitateToPoint pulls all the particles in this bin to the given point.
func (*Bin) RandomizeVelocity ¶
RandomizeVelocity randomizes the velocity of all particles in this bin.
func (*Bin) RepelFrom ¶
RepelFrom repels all the particles in this bin from the given x, y point to the given radius.
func (*Bin) SetMaxVelocity ¶
SetMaxVelocity sets the maximum velocity for all particles in this bin.
func (*Bin) SpringToDust ¶
SpringToDust springs all the particles in this bin to the given dust particle.
func (*Bin) SpringToPoint ¶
SpringToPoint springs all the particles in this bin to the given point.
func (*Bin) SpringToRadius ¶
SpringToRadius springs all particles to a distance away from the given x, y point.
type ConfigFunc ¶
type ConfigFunc func(d *Dust)
ConfigFunc is a function that will configure a newly emitted dust particle.
type Dust ¶
Dust represents a single particle.
func (*Dust) AddVelocity ¶
AddVelocity adds velocity to the current velocity for this particle.
func (*Dust) BounceCircle ¶
BounceCircle causes a particle to bounce off the specified circle.
func (*Dust) GravitateTo ¶
GravitateTo pulls the particle towards the given x, y, point.
func (*Dust) GravitateToDust ¶
GravitateToDust pulls the particle towards the given dust particle.
func (*Dust) GravitateToPoint ¶
GravitateToPoint pulls the particle towards the given point.
func (*Dust) RepelFrom ¶
RepelFrom pushes the particle towards the given x, y, point to the given radius.
func (*Dust) SetHeading ¶
SetHeading sets the direction this particle will move in.
func (*Dust) SetRandomVelocity ¶
SetRandomVelocity sets a random velocity for this particle.
func (*Dust) SetVelocityHeading ¶
SetVelocityHeading sets the overal velocity and heading of this particle.
func (*Dust) SetVelocityXY ¶
SetVelocityXY sets the current velocity on each axis for this particle.
func (*Dust) SpringToDust ¶
SpringToDust springs the particle towards the given dust particle.
func (*Dust) SpringToPoint ¶
SpringToPoint springs the particle towards the given point.
func (*Dust) SpringToRadius ¶
SpringToRadius springs this particles to a distance away from the given x, y point.
type Emitter ¶
type Emitter struct {
X, Y float64
Rate int
Age, MaxAge int
// contains filtered or unexported fields
}
Emitter defines a dust particle emitter.
func NewEmitter ¶
NewEmitter creates a new Emitter.
func (*Emitter) Config ¶
func (e *Emitter) Config(c ConfigFunc)
Config sets a function to configure particles created by this emitter.