This repository was archived by the owner on Feb 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Max Narvaez edited this page Jan 19, 2020
·
5 revisions
An AnimationSender struct contains an ip field (type string) and a port field (type int).
sender := AnimationSender{}
sender.ip = "10.0.0.254"
sender.port = 5
// or
sender := AnimationSender{
ip: "10.0.0.254",
port: 5,
}An AnimationSender is started by calling the Start() method on the instance.
sender.Start()To stop the AnimationSender, call its End() method.
sender.End()An animation can be sent to the server by creating an instance of the AnimationData struct, then calling SendAnimation with the struct as the argument.
cc := ColorContainer{}
cc.AddColor(0xFF)
cc.AddColor(0xFF00)
data := AnimationData() // Note that this is a function call
// that returns an animationData struct pointer
data.AddColor(&cc)
sender.SendAnimation(data)The Go library uses the following values for animation, continuous and direction:
-
animation:COLOR,ALTERNATE,RIPPLE, etc. -
continuous:DEFAULT,CONTINUOUS,NONCONTINUOUS -
direction:FORWARD,BACKWARD
Received animations are saved to RunningAnimations, which is a RunningAnimationMap (which is a thread-safe map).
To retrieve an animation, use
sender.RunningAnimations.Load(ID)where ID is the string ID of the animation.
To get a list of all animation IDs, use
ids := sender.RunningAnimations.Keys()