# `GSFrameView updateViewportToScale:origin:`

*Instance Method*

Updates the scale and origin (scroll point) of the viewport (visible part of the frame).

## Declaration

```swift
func updateViewport(toScale targetScale: CGFloat, origin targetOrigin: NSPoint)
```

```objc
- (void) updateViewportToScale:(CGFloat) targetScale origin:(NSPoint) targetOrigin;
```

```python
updateViewportToScale_origin_(targetScale: float, targetOrigin: NSPoint)
```

## Parameters

- `targetScale` — The desired scale. `CGFLOAT_MAX` when the scale should not be changed.
- `targetOrigin` — The desired origin as returned by `-scrollPointFromPoint:toReferencePoint:`. Use an `x` coordinate of `CGFLOAT_MAX` when the origin should not be changed.

## Discussion

Animates to the new scale and/or origin when enclosed in a `NSAnimationContext` with implicit animations enabled.

The animation duration will be no longer than the duration of the animation context. However, the effective animation duration might be shorter to compensate for minor visual adjustments.

Existing animations will be modified to retarget the new scale and/or origin.

