-
Notifications
You must be signed in to change notification settings - Fork 1
/
animation.go
38 lines (30 loc) · 943 Bytes
/
animation.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package mawt
// This file contains the interfaces to the TeamNorCal animation suite
//
// This package will request sets of frames from the animation library that
// represent actions occuring within the portal and will play these back
// to the fadecandy server interface
import (
"time"
"github.com/karlmutch/errors"
"github.com/TeamNorCal/animation"
animationModel "github.com/TeamNorCal/animation/model"
"github.com/TeamNorCal/mawt/model"
)
type statusSink struct {
statusC chan *model.PortalStatus
portal animationModel.Portal
}
func NewSink() (sink *statusSink) {
return &statusSink{
statusC: make(chan *model.PortalStatus),
portal: animation.NewPortal(),
}
}
func (sink *statusSink) UpdateStatus(status *model.Status) (err errors.Error) {
sink.portal.UpdateFromCanonicalStatus(status)
return nil
}
func (sink *statusSink) GetFrame(tm time.Time) []animationModel.ChannelData {
return sink.portal.GetFrame(tm)
}