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
Dart
Max Narvaez edited this page Jan 18, 2020
·
5 revisions
An AnimationSender is constructed with two arguments:
-
host: The IP address of the server (as a string) -
port: The port that the client should connect to (as an integer)
var sender = AnimationSender("10.0.0.254", 5);An AnimationSender is started by calling the start() method on the instance.
await sender.start(); // Note that this requires your
// method to have the async keywordTo stop the AnimationSender, call its end() method.
sender.end();An animation can be sent to the server by creating an AnimationData instance, then calling sendAnimation with the instance as the argument.
var cc = ColorContainer()
..addColor(0xFF)
..addColor(0xFF00);
var data = AnimationData()
..addColor(cc);
sender.sendAnimation(data);The Dart library uses the following values for animation, continuous and direction:
-
animation:Animation.COLOR,Animation.ALTERNATE,Animation.RIPPLE, etc. -
continuous:null,true,false -
direction:Direction.FORWARD,Direction.BACKWARD
Received animations are saved to running_animations, which is a RunningAnimationMap (which is a thread-safe map).
To retrieve an animation, use
var anim = await sender.running_animations.get(ID);where ID is the string ID of the animation.
To get a list of all animation IDs, use
var ids = await sender.running_animations.ids();Currently, animations are not removed when an ENDANIMATION signal is received.
This will be added in a future update.