applyRelativeLocal method

void applyRelativeLocal()

Implementation

void applyRelativeLocal() {
  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) {
      rotation =
          rotation + (target.arotation + data.offsetRotation) * rotateMix;
    }

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

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

    double shearY = bone.ashearY;
    if (shearMix > 0) {
      shearY = shearY + (target.ashearY + data.offsetShearY) * shearMix;
    }

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