add gradient and random effect.
This commit is contained in:
+16
-25
@@ -55,27 +55,15 @@ func main() {
|
||||
|
||||
time.Sleep(time.Millisecond)
|
||||
|
||||
bus.RunEvent(events.HardwareState{
|
||||
ID: "nanoleaf:10.80.1.11:40e5",
|
||||
InternalName: "Hexagon 6",
|
||||
SupportFlags: device.SFlagPower | device.SFlagColor | device.SFlagIntensity,
|
||||
ColorFlags: device.CFlagRGB,
|
||||
State: device.State{},
|
||||
})
|
||||
bus.RunEvent(events.HardwareState{
|
||||
ID: "nanoleaf:10.80.1.11:dead",
|
||||
InternalName: "Hexagon 7",
|
||||
SupportFlags: device.SFlagPower | device.SFlagColor | device.SFlagIntensity,
|
||||
ColorFlags: device.CFlagRGB,
|
||||
State: device.State{},
|
||||
})
|
||||
bus.RunEvent(events.HardwareState{
|
||||
ID: "nanoleaf:10.80.1.11:beef",
|
||||
InternalName: "Hexagon 8",
|
||||
SupportFlags: device.SFlagPower | device.SFlagColor | device.SFlagIntensity,
|
||||
ColorFlags: device.CFlagRGB,
|
||||
State: device.State{},
|
||||
})
|
||||
for i, id := range []string{"40e5", "dead", "beef", "cafe", "1337"} {
|
||||
bus.RunEvent(events.HardwareState{
|
||||
ID: "nanoleaf:10.80.1.11:" + id,
|
||||
InternalName: fmt.Sprintf("Hexagon %d", 6+i),
|
||||
SupportFlags: device.SFlagPower | device.SFlagColor | device.SFlagIntensity,
|
||||
ColorFlags: device.CFlagRGB,
|
||||
State: device.State{},
|
||||
})
|
||||
}
|
||||
|
||||
time.Sleep(time.Millisecond)
|
||||
|
||||
@@ -90,22 +78,25 @@ func main() {
|
||||
|
||||
time.Sleep(time.Millisecond)
|
||||
|
||||
c1 := gentools.Ptr(color.MustParse("rgb:#ff0000"))
|
||||
c2 := gentools.Ptr(color.MustParse("rgb:#00ff00"))
|
||||
bus.RunCommand(commands.Assign{
|
||||
Match: "**:Hexagon *",
|
||||
Effect: effects.Pattern{
|
||||
Effect: effects.Gradient{
|
||||
States: []device.State{
|
||||
{
|
||||
Power: gentools.Ptr(true),
|
||||
Color: gentools.Ptr(color.MustParse("rgb:#ff0000")),
|
||||
Color: c1,
|
||||
Intensity: gentools.Ptr(1.0),
|
||||
},
|
||||
{
|
||||
Power: gentools.Ptr(true),
|
||||
Color: gentools.Ptr(color.MustParse("rgb:#00ff00")),
|
||||
Color: c2,
|
||||
Intensity: gentools.Ptr(0.7),
|
||||
},
|
||||
},
|
||||
ShiftMS: 1000,
|
||||
AnimationMS: 1000,
|
||||
Interpolate: true,
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user