---
title: "translateBy(x:y:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/translateby(x:y:)"
---

# translateBy(x:y:)

Changes the origin of the user coordinate system in a context.

## Declaration

```swift
func translateBy(x tx: CGFloat, y ty: CGFloat)
```

## Parameters

- `tx`: The amount to displace the x-axis of the coordinate space, in units of the user space, of the specified context.
- `ty`: The amount to displace the y-axis of the coordinate space, in units of the user space, of the specified context.

## See Also

### Working with the Current Transformation Matrix

- [ctm](coregraphics/cgcontext/ctm.md)
- [rotate(by:)](coregraphics/cgcontext/rotate(by:).md)
- [scaleBy(x:y:)](coregraphics/cgcontext/scaleby(x:y:).md)
- [concatenate(_:)](coregraphics/cgcontext/concatenate(_:).md)
