<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.0.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreGraphics",
  "identifier" : "/documentation/CoreGraphics/CGAffineTransformMakeTranslation(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Graphics"
    ],
    "preciseIdentifier" : "c:@F@CGAffineTransformMakeTranslation"
  },
  "title" : "CGAffineTransformMakeTranslation(_:_:)"
}
-->

# CGAffineTransformMakeTranslation(_:_:)

Returns an affine transformation matrix constructed from translation values you provide.

```
func CGAffineTransformMakeTranslation(_ tx: CGFloat, _ ty: CGFloat) -> CGAffineTransform
```

## Parameters

`tx`

The value by which to move the x-axis of the coordinate system.

`ty`

The value by which to move the y-axis of the coordinate system.

## Return Value

A new affine transform matrix.

## Discussion

This function creates a `CGAffineTransform` structure. which you can use (and reuse, if you want) to move a coordinate system. The matrix takes the following form:

![A 3 by 3 matrix for translation.](images/com.apple.coregraphics/media-1966750@2x.png)

Because the third column is always `(0,0,1)`, the `CGAffineTransform` data structure returned by this function contains values for only the first two columns.

These are the resulting equations used to apply the translation to a point (x,y):

![Translation equations.](images/com.apple.coregraphics/media-1966756@2x.png)

If you want only to move the location where an object is drawn, it is not necessary to construct an affine transform to do so. The most direct way to move your drawing is by calling the function [`translateBy(x:y:)`](/documentation/CoreGraphics/CGContext/translateBy(x:y:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)