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" "time" )
type Gradient struct { States []device.State `json:"states,omitempty"` AnimationMS int64 `json:"AnimationMs,omitempty"` Reverse bool `json:"backward,omitempty"` Interpolate bool `json:"interpolate,omitempty"` }
func (e Gradient) State(index, length, round int) device.State { if len(e.States) == 0 { return device.State{} }
if e.Reverse { round = -round } walkedIndex := ((length + index) - round) % length
return gradientState(e.States, e.Interpolate, walkedIndex, length) }
func (e Gradient) Frequency() time.Duration { return time.Duration(e.AnimationMS) * time.Millisecond }
func (e Gradient) EffectDescription() string { return fmt.Sprintf("Gradient(states:%s, anim:%dms, int:%t)", statesDescription(e.States), e.AnimationMS, e.Interpolate) }
|