Call seen() whenever there is a point to track, for example, based on a ‘pointermove’ event.
seen() returns Type Trackers.PointTrackerResults - { fromInitial, fromLast, values } - which can be used for comparing the latest point with the initial point or the last point. values is a set of all the recorded points, fromInitial and fromLast yield the relation between the very first seen point and the last point. For both of these, you get:
For example:
In action
In the example below, we start tracking when the pointer is down and add points when there is a pointer move event.
If you want to keep track of several different logical points, for example different touches in a multi-touch gesture, or body parts in TensorFlow, it can be a pain to create and manage several PointTracker instances.
Trackers.points to the rescue! It does all this housekeeping for you. Usage is very similar to the PointTracker, but now we have a TrackedPointMap .
And then whenever there is new data for a point, call seen(), giving the id of the point, and then the point ({x: .., y: ...}). This could be based on a pointer event, or when new predictions are made by TensorFlow, for example.
In the example below, we track each named pointer id.
To get data:
Under-the-hood, it automatically creates a PointTracker for each named point. This can be retrieved using t.get(id). And then you can use all the single-point tracking features described earlier.