toJSON static method
dynamic
toJSON(
- dynamic track
Implementation
static toJSON(track) {
var trackType = track.constructor;
dynamic json;
// derived classes can define a static toJSON method
if (trackType.toJSON != null) {
json = trackType.toJSON(track);
} else {
// by default, we assume the data can be serialized as-is
json = {
'name': track.name,
'times': AnimationUtils.convertArray(track.times, "List<num>"),
'values': AnimationUtils.convertArray(track.values, "List<num>")
};
var interpolation = track.getInterpolation();
if (interpolation != track.defaultInterpolation) {
json.interpolation = interpolation;
}
}
json.type = track.valueTypeName; // mandatory
return json;
}