Documentation
¶
Index ¶
- func CopyBool(b *bool) *bool
- func CopyColor(c color.Color) color.Color
- func CopyDuration(d *time.Duration) *time.Duration
- func CopyFloat64(f *float64) *float64
- func CopyTime(t *time.Time) *time.Time
- type Bender
- type Colorable
- type Colored
- type Device
- type DeviceInfo
- type Effect
- type Indexed
- type Locatable
- type Located
- type Moveable
- type Moved
- type Node
- type NodeInfo
- type Orientable
- type Oriented
- type Painter
- type Palette
- type Renderable
- type Seeder
- type Shifter
- type Spanner
- type Stabilizer
- type Tangible
- type Vibe
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyBool ¶
CopyBool returns a deep copy of a *bool if its not nil Used by the Copy functions of palette providers
func CopyColor ¶
CopyColor returns a deep copy of an color.Color if its not nil Used by the Copy functions of palette providers
func CopyDuration ¶
CopyDuration returns a deep copy of a *time.Duration if its not nil Used by the Copy functions of palette providers
func CopyFloat64 ¶
CopyFloat64 returns a deep copy of a *float64 if its not nil Used by the Copy functions of palette providers
Types ¶
type Bender ¶
type Bender interface {
Stabilizer
// Bend returns a value based on f
Bend(f float64) float64
// Copy returns a deep copy of the Bender
Copy() Bender
}
Bender is used by Shifters to change small things over time
func CopyBender ¶
CopyBender returns a deep copy of an Bender if its not nil Used by the Copy functions of palette providers
type Colorable ¶
type Colorable interface {
Colored
// SetColor changes the color of the light
SetColor(newColor color.Color)
}
Colorable is the interface to something which is colorable
type Device ¶
type Device interface {
Moveable
DeviceInfo
// GetNodes returns all the Nodes which the device holds
GetNodes() []Node
// DispatchRender produces and dispatches Instructions
DispatchRender(time.Time) error
// JSON for persistance
json.Marshaler
json.Unmarshaler
}
Device represents a physical device with lights A device is made up of at least a single Node
type DeviceInfo ¶
type DeviceInfo interface {
Moved
// GetType returns the type
GetType() string
// GetID will return the ID of a device node.
GetID() uuid.UUID
// GetNodeInfos returns all the Nodes which the device holds
GetNodeInfos() []NodeInfo
}
DeviceInfo is the read-only portion of a Device
type Effect ¶
type Effect interface {
Spanner
Stabilizer
// Render will alter obj based on its information and alterability
// obj is at least Renderable,
// but can be any of the other interfaces in renderable.go
Render(t time.Time, obj Renderable)
// Priority solves rendering issues
Priority() int
// Set sets the start and end of a span from the provided span
SetSpan(ss Spanner)
// Copy returns a deep copy of a Effect
Copy() Effect
}
Effect is a light abstraction representing patterns of colors
func CopyEffect ¶
CopyEffect returns a deep copy of an Effect if its not nil Used by the Copy functions of palette providers
type Indexed ¶
type Indexed interface {
// GetPosition returns the position and total
// i.e. #3 of 10
GetPosition() (int, int)
}
Indexed is the interface to something which is in an ordered set
type Locatable ¶
type Locatable interface {
// GetLocation returns the location of the object
GetLocation() space.Vector
// SetLocation changes the location of the object
SetLocation(space.Vector)
}
Locatable is the interface to something which can be positioned in space
type Located ¶
type Located interface {
// GetLocation returns the location of the object
GetLocation() space.Vector
}
Located is the interface to something which exists in space
type Moveable ¶
type Moveable interface {
Moved
// Move changes all properties of the device
Move(location space.Vector, orientation space.Quaternion)
}
Moveable is the interface to something which is moveable in space (Should have no symmetry)
type Moved ¶
type Moved interface {
// GetBearings returns all spacial properties of the device
GetBearings() (location space.Vector, orientation space.Quaternion)
}
type Node ¶
type Node interface {
NodeInfo
// Allocate passes Vibe into this device and its children
// Allocate typically Stabilize the Vibe before passing it to children devices
Allocate(Vibe)
// Clean removes all stored resources which ended before a time
Clean(time.Time)
// GetChildren returns any children under the node
GetChildren() []Node
// Insert will insert a node underneath a parent node.
Insert(parentID uuid.UUID, newNode Node) error
// Delete will delete a node underneath a parent node.
Delete(parentID, childID uuid.UUID) error
// JSON for persistance
json.Marshaler
json.Unmarshaler
}
A Node is a node in the tree Nodes can reference an object which is also a Device or part of a Device Node can also be an abstraction which has a Device as a parent or child
type NodeInfo ¶
type NodeInfo interface {
// GetType returns the type
GetType() string
// GetID will return the ID of a device node.
GetID() uuid.UUID
// GetChildrenInfo returns any children under the node
GetChildrenInfo() []NodeInfo
// GetNodeInfo finds a given NodeInfo with a matching nodeID
// through tree traversal
GetNodeInfo(nodeID uuid.UUID) NodeInfo
}
NodeInfo is the read-only portion of a Node
type Orientable ¶
type Orientable interface {
Locatable
// GetOrientation returns the Orientation of the object
GetOrientation() space.Quaternion
// SetOrientation changes the Orientation of the object
SetOrientation(space.Quaternion)
}
Orientable is the interface to something which is orientable in space
type Oriented ¶
type Oriented interface {
Located
// GetOrientation returns the Orientation of the object
GetOrientation() space.Quaternion
}
Oriented is the interface to something which is oriented in space
type Painter ¶
type Painter interface {
Stabilizer
// Paint returns a color based on t and obj
// obj should be at least Renderable,
// but can be any of the other interfaces specified in renderable.go
Paint(t time.Time, obj Renderable)
// Copy returns a deep copy of the Painter
Copy() Painter
}
Painter is used by effects to select colors
func CopyPainter ¶
CopyPainter returns a deep copy of an Painter if its not nil Used by the Copy functions of palette providers
type Palette ¶
type Palette interface {
Seeder
// SelectEffect returns a Effect
SelectEffect() Effect
// SelectPainter returns a Painter
SelectPainter() Painter
// SelectShifterHue returns a Shifter which is aimed to shift hues
SelectShifterHue() Shifter
// SelectShifterLightness returns a Shifter which is aimed to shift lightness
SelectShifterLightness() Shifter
// SelectShifterSaturation returns a Shifter which is aimed to shift saturation
SelectShifterSaturation() Shifter
// SelectBender returns a Bender
SelectBender() Bender
// SelectColor returns a Color
SelectColor() color.Color
// SelectDuration returns a Duration
// Should generally range from 0.1s to 10s
SelectDuration() time.Duration
}
type Renderable ¶
type Seeder ¶
type Seeder interface {
// NextSeed returns an ever changing seed for repeatable randomization
NextSeed() time.Time
// Option will choose a option from a range
// where the options is [0, options)
Option(options int) int
// Chance will determine an outcome based on a percentage [0, 1]
Chance(chance float64) bool
// RandDuration will return a random duration [min, max]
RandDuration(min, max time.Duration) time.Duration
// RandShift provides a random shift [min, max] with granularity of unit
RandShift(min, max, unit float64) float64
}
Seeder can produce changing seeds for repeatable randomization
type Shifter ¶
type Shifter interface {
Stabilizer
// Shift returns a value representing some change or shift based on t and obj
// obj should be at least Tangible,
// but can be any of the other interfaces specified in renderable.go
Shift(t time.Time, obj Tangible) float64
// Copy returns a deep copy of the Shifter
Copy() Shifter
}
Shifter is used by Painters to change small things over time
func CopyShifter ¶
CopyShifter returns a deep copy of an Shifter if its not nil Used by the Copy functions of palette providers
type Spanner ¶
type Spanner interface {
// Start returns the Start times
Start() time.Time
// SetStart sets the Start time
SetStart(start time.Time)
// End returns the End time
End() time.Time
// SetEnd sets the End time
SetEnd(end time.Time)
}
Spanner is any object which has a beginning and end in time
type Stabilizer ¶
type Stabilizer interface {
// GetStabilizeFuncs returns a function for all remaining unstabilized traits
GetStabilizeFuncs() []func(p Palette)
}
type Tangible ¶
type Tangible interface {
Indexed
Orientable
}
type Vibe ¶
type Vibe interface {
Palette
Stabilizer
Spanner
// Duplicate creates a copy of a vibe and insures that
// the duplicated vibe will stabilize/materialize differently
Duplicate() Vibe
// Stabilize locks in part of the visual representation of a vibe.
Stabilize() Vibe
// Materialize locks all remaining unlocked visuals of a vibe
// then returns the resulting effects
Materialize() []Effect
}
Vibe is a heavy abstraction correlating to general feelings in music