read static method

ActorNode read(
  1. ActorArtboard artboard,
  2. StreamReader reader,
  3. ActorNode? node
)
override

Implementation

static ActorNode read(
    ActorArtboard artboard, StreamReader reader, ActorNode? node) {
  // ignore: parameter_assignments
  node ??= ActorNode();
  ActorComponent.read(artboard, reader, node);
  Vec2D.copyFromList(
      node._translation, reader.readFloat32Array(2, 'translation'));
  node._rotation = reader.readFloat32('rotation');
  Vec2D.copyFromList(node._scale, reader.readFloat32Array(2, 'scale'));
  node._opacity = reader.readFloat32('opacity');
  node._isCollapsedVisibility = reader.readBool('isCollapsed');

  reader.openArray('clips');
  int clipCount = reader.readUint8Length();
  if (clipCount > 0) {
    node._clips = <ActorClip>[];
    for (int i = 0; i < clipCount; i++) {
      reader.openObject('clip');
      var clip = ActorClip(reader.readId('node'));
      if (artboard.actor.version >= 23) {
        clip.intersect = reader.readBool('intersect');
      }
      reader.closeObject();
      node._clips!.add(clip);
    }
  }
  reader.closeArray();
  return node;
}