<!--
{
  "availability" : [
    "macOS: 10.10.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/AffineTransform/init(translationByX:byY:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "s:10Foundation15AffineTransformV14translationByX3byYAC04CoreA07CGFloatV_AHtcfc"
  },
  "title" : "init(translationByX:byY:)"
}
-->

# init(translationByX:byY:)

Creates an affine transformation matrix from translation values.

```
init(translationByX x: CGFloat, byY y: CGFloat)
```

## Parameters

`x`

The horizontal translation value.

`y`

The vertical translation value.

## Discussion

The matrix takes the following form:

```swift
[ 1  0  0 ]
[ 0  1  0 ]
[ x  y  1 ]
```

---

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)