applyAbsoluteLocal method

void applyAbsoluteLocal()

Implementation

void applyAbsoluteLocal() {
  final double rotateMix = this.rotateMix,
      translateMix = this.translateMix,
      scaleMix = this.scaleMix,
      shearMix = this.shearMix;
  final Bone target = this.target!;
  if (!target.appliedValid) target.updateAppliedTransform();
  final List<Bone> bones = this.bones;
  final int n = bones.length;
  for (int i = 0; i < n; i++) {
    final Bone bone = bones[i];
    if (!bone.appliedValid) bone.updateAppliedTransform();

    double rotation = bone.arotation;
    if (rotateMix != 0) {
      double r = target.arotation - rotation + data.offsetRotation;
      r -= (16384 - (16384.499999999996 - r / 360).toInt()) * 360;
      rotation += r * rotateMix;
    }

    double x = bone.ax, y = bone.ay;
    if (translateMix != 0) {
      x = x + (target.ax - x + data.offsetX) * translateMix;
      y = y + (target.ay - y + data.offsetY) * translateMix;
    }

    double scaleX = bone.ascaleX, scaleY = bone.ascaleY;
    if (scaleMix > 0) {
      if (scaleX > 0.00001) {
        scaleX = (scaleX +
                (target.ascaleX - scaleX + data.offsetScaleX) * scaleMix) /
            scaleX;
      }
      if (scaleY > 0.00001) {
        scaleY = (scaleY +
                (target.ascaleY - scaleY + data.offsetScaleY) * scaleMix) /
            scaleY;
      }
    }

    final double shearY = bone.ashearY;
    if (shearMix > 0) {
      double r = target.ashearY - shearY + data.offsetShearY;
      r -= (16384 - (16384.499999999996 - r / 360).toInt()) * 360;
      bone.shearY = bone.shearY + r * shearMix;
    }

    bone.updateWorldTransformWith(
        x, y, rotation, scaleX, scaleY, bone.ashearX, shearY);
  }
}