setUvTransform method

Matrix3 setUvTransform(
  1. double tx,
  2. double ty,
  3. double sx,
  4. double sy,
  5. double rotation,
  6. double cx,
  7. double cy,
)

tx - offset x

ty - offset y

sx - repeat x

sy - repeat y

rotation - rotation, in radians. Positive values rotate counterclockwise

cx - center x of rotation

cy - center y of rotation

Sets the UV transform matrix from offset, repeat, rotation, and center.

Implementation

Matrix3 setUvTransform(double tx, double ty, double sx, double sy, double rotation, double cx, double cy) {
  final c = math.cos(rotation);
  final s = math.sin(rotation);

  setValues(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c,
      -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);

  return this;
}