|
|
@ -75,7 +75,7 @@ func listener(mqMessages chan mqtt.Message) {
|
|
|
|
//animator is a wrapping function for go routine that can receive an mq channel
|
|
|
|
//animator is a wrapping function for go routine that can receive an mq channel
|
|
|
|
func animator(tk *rgbmatrix.ToolKit, mqMessages chan mqtt.Message) {
|
|
|
|
func animator(tk *rgbmatrix.ToolKit, mqMessages chan mqtt.Message) {
|
|
|
|
//Playanimation comes from the toolkit, all it takes is an animation struct
|
|
|
|
//Playanimation comes from the toolkit, all it takes is an animation struct
|
|
|
|
tk.PlayAnimation(NewAnimation(image.Point{64, 32}, mqMessages))
|
|
|
|
tk.PlayAnimation(NewAnimation(image.Point{64, 64}, mqMessages))
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -144,7 +144,7 @@ func NewAnimation(sz image.Point, mqMessages chan mqtt.Message) *Animation {
|
|
|
|
func appendImage(img string, a *Animation) {
|
|
|
|
func appendImage(img string, a *Animation) {
|
|
|
|
baseImage, _ := b64.StdEncoding.DecodeString(img)
|
|
|
|
baseImage, _ := b64.StdEncoding.DecodeString(img)
|
|
|
|
bigImage, _, _ := image.Decode(bytes.NewReader(baseImage))
|
|
|
|
bigImage, _, _ := image.Decode(bytes.NewReader(baseImage))
|
|
|
|
a.image = append(a.image, imaging.Resize(bigImage, 32, 32, imaging.Lanczos))
|
|
|
|
a.image = append(a.image, imaging.Resize(bigImage, 64, 64, imaging.Lanczos))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// what happens each frame, at an interval of 50 milliseconds
|
|
|
|
// what happens each frame, at an interval of 50 milliseconds
|
|
|
|