You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package effects
import ( "fmt" "git.aiterp.net/lucifer3/server/device" "math/rand" "time" )
type Random struct { States []device.State `json:"states,omitempty"` Interpolate bool `json:"interpolate,omitempty"` AnimationMS int64 `json:"animationMs,omitempty"` }
func (e Random) State(_, _, _ int) device.State { if len(e.States) == 0 { return device.State{} }
return gradientStateFactor(e.States, e.Interpolate, rand.Float64()) }
func (e Random) Frequency() time.Duration { return time.Duration(e.AnimationMS) * time.Millisecond }
func (e Random) EffectDescription() string { return fmt.Sprintf("Random(states:%s, anim:%dms, int:%t)", statesDescription(e.States), e.AnimationMS, e.Interpolate) }
|