updateTransformByAngle method

void updateTransformByAngle(
  1. double offsetAngle
)

Implementation

void updateTransformByAngle(double offsetAngle) {
  baseAngleOffset -= offsetAngle;
  for (int index = 0; index < _galleryItemTransformInfoList.length; index++) {
    _GalleryItemTransformInfo transformInfo =
        _galleryItemTransformInfoList[index];

    double angle = getItemAngle(index);
    double scale = transformInfo.scale;
    Offset offset = transformInfo.offset;

    if (baseAngleOffset.abs() > 360) {
      baseAngleOffset %= 360;
    }

    angle += baseAngleOffset;
    angle = angle % 360;

    //计算椭圆轨迹的点
    offset = calculateOffset(angle);

    ///计算缩放参数
    scale = calculateScale(angle);

    transformInfo
      ..angle = angle
      ..scale = scale
      ..offset = offset;
  }
}