transform method

  1. @override
TimelineValue<T> transform(
  1. double t
)
override

Computes the tween

Implementation

@override
TimelineValue<T> transform(double t) {
  var now = t * duration.inMicroseconds;
  var allItems = _generateAbsoluteItems();

  // It's faster to sort the entire array once than chop it up then sort each
  // property-specific sub-array. The sorting is done because
  // _transformProperty wants to process the scene items in `begin` order.
  allItems.sort((a, b) => a.begin - b.begin);

  // Each list in this map is automatically sorted because allItems
  // is already pre-sorted by `begin` property. No extra sorting is
  // necessary.
  var propertyItems = <T, List<_AbsoluteSceneItem>>{};
  for (var item in allItems) {
    var items = propertyItems[item.property];
    if (items == null) {
      propertyItems[item.property] = items = <_AbsoluteSceneItem>[];
    }
    items.add(item);
  }

  var valueMap = <T, dynamic>{};

  for (var property in propertyItems.keys) {
    _transformProperty(propertyItems[property]!, property, now, valueMap);
  }

  return TimelineValue<T>(map: valueMap);
}