Table of Contents

Class VideoEffectPan

Namespace
VisioForge.Core.Types.VideoEffects
Assembly
VisioForge.Core.dll

Represents an animated pan and zoom effect that smoothly transitions the visible region of the video from one position and size to another over time.

public class VideoEffectPan : VideoEffect, IVideoEffectPan, IVideoEffect

Inheritance

Implements

Inherited Members

Remarks

SDK Availability: VideoCaptureCore, MediaPlayerCore, VideoEditCore (Windows only)

Platform Support: Windows only

The pan effect, also known as the Ken Burns effect, creates smooth animated camera movements by transitioning from a starting viewport (defined by position and size) to an ending viewport over the specified time range. This enables creating dynamic storytelling effects, focus transitions, and professional-looking camera movements without requiring actual camera motion.

Key features of the pan effect include:

  • Simultaneous animated zoom and position changes for natural camera movement simulation
  • Independent control of starting and ending viewport rectangles
  • Smooth interpolation between start and end positions over time
  • Configurable interpolation quality for optimal performance vs. quality trade-off

Common use cases include:

  • Creating Ken Burns effects on static images in video slideshows
  • Implementing smooth camera movements in video editing projects
  • Drawing viewer attention to specific regions of interest during playback
  • Adding dynamic motion to otherwise static video content
  • Creating professional documentary-style focus transitions
  • Simulating zoom-in reveals or zoom-out context effects

The effect works by defining a rectangular viewport at the start time (using VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartX, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartY, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartWidth, and VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartHeight) and another at the stop time (using VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopX, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopY, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopWidth, and VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopHeight). The video processing engine automatically interpolates all parameters linearly between these two states, creating smooth motion.

For static zoom effects without animation, consider using VisioForge.Core.Types.VideoEffects.VideoEffectZoom instead, which provides simpler configuration when animated transitions are not needed.

The quality of the pan effect is controlled by the VisioForge.Core.Types.VideoEffects.VideoEffectPan.InterpolationMode property, which determines how pixels are resampled during the zoom and pan operations. Higher quality modes produce smoother results but require more processing power.

Constructors

VideoEffectPan(bool, string, TimeSpan, TimeSpan)

Initializes a new instance of the VisioForge.Core.Types.VideoEffects.VideoEffectPan class with specified parameters.

public VideoEffectPan(bool enabled, string name = "Pan", TimeSpan startTime = default, TimeSpan stopTime = default)

Parameters

enabled bool

true to enable the effect immediately; false to create the effect in a disabled state. The effect can be enabled later by setting the VisioForge.Core.Types.VideoEffects.VideoEffect.Enabled property.

name string

An optional name identifier for this effect instance. Default is "Pan". This name can be used to retrieve and control the effect through the video processing pipeline.

startTime TimeSpan

The time at which the pan effect should begin. This marks the point where the viewport is at its starting position and size. Required for the pan animation to function correctly.

stopTime TimeSpan

The time at which the pan effect should complete. This marks the point where the viewport reaches its ending position and size. The duration between startTime and stopTime determines the speed of the pan animation. Required for the pan animation to function correctly.

Remarks

After construction, you must configure the viewport rectangles by setting the start and stop properties:

  • Starting viewport: VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartX, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartY, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartWidth, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartHeight
  • Ending viewport: VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopX, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopY, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopWidth, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopHeight

The pan effect requires valid time ranges to animate. Both startTime and stopTime should be properly configured to define when and how fast the animation occurs. A longer duration (larger difference between times) creates slower, more subtle motion.

The effect smoothly interpolates all viewport parameters linearly over time. For more complex animation curves, consider applying multiple sequential pan effects with different timing.

The VisioForge.Core.Types.VideoEffects.VideoEffectPan.InterpolationMode property defaults to VisioForge.Core.Types.VideoInterpolationMode.Bilinear but can be changed after construction to optimize for quality or performance.

Properties

InterpolationMode

Gets or sets the interpolation algorithm used for scaling the video during pan and zoom operations.

public VideoInterpolationMode InterpolationMode { get; set; }

Property Value

VideoInterpolationMode

Remarks

The interpolation mode determines the quality and performance characteristics of the pan effect. Different modes offer varying trade-offs:

  • VisioForge.Core.Types.VideoInterpolationMode.NearestNeighbor: Fastest performance, but may produce blocky or pixelated results during zoom operations
  • VisioForge.Core.Types.VideoInterpolationMode.Bilinear: Good balance of quality and performance, suitable for most use cases (default)
  • VisioForge.Core.Types.VideoInterpolationMode.Bicubic: Higher quality with smoother results, recommended for final renders and zoom-in effects
  • VisioForge.Core.Types.VideoInterpolationMode.Lancroz: Highest quality with sharpest results, best for zoom-out and high-quality productions, most CPU intensive

For real-time preview or live video processing, VisioForge.Core.Types.VideoInterpolationMode.Bilinear provides the best balance. For final video export or high-quality productions, consider using VisioForge.Core.Types.VideoInterpolationMode.Bicubic or VisioForge.Core.Types.VideoInterpolationMode.Lancroz.

The quality differences become more noticeable when:

  • Zooming in significantly (when stop dimensions are much smaller than start dimensions)
  • Working with high-resolution source video (4K or higher)
  • Viewing on large displays or in fullscreen mode

StartHeight

Gets or sets the starting height of the viewport rectangle in pixels.

public int StartHeight { get; set; }

Property Value

int

Remarks

Defines the vertical size of the visible region at the beginning of the pan effect. Smaller values create a more zoomed-in view, while larger values create a taller view.

When VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartHeight differs from VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopHeight, the effect includes a vertical zoom component. Decreasing height creates a zoom-in effect, while increasing height creates a zoom-out effect.

The viewport defined by VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartY + VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartHeight must not exceed the original video frame height.

StartWidth

Gets or sets the starting width of the viewport rectangle in pixels.

public int StartWidth { get; set; }

Property Value

int

Remarks

Defines the horizontal size of the visible region at the beginning of the pan effect. Smaller values create a more zoomed-in view, while larger values create a wider view.

When VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartWidth differs from VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopWidth, the effect includes a zoom component. Decreasing width (StartWidth > StopWidth) creates a zoom-in effect, while increasing width creates a zoom-out effect.

The viewport defined by VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartX + VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartWidth must not exceed the original video frame width.

StartX

Gets or sets the starting horizontal position of the viewport rectangle in pixels.

public int StartX { get; set; }

Property Value

int

Remarks

Defines the left edge of the visible region at the beginning of the pan effect. The value represents the X coordinate in pixels from the left edge of the original video frame.

When combined with VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopX, this creates horizontal panning motion. If both values are equal, no horizontal motion occurs (only vertical motion and/or zoom).

Ensure the starting viewport (defined by VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartX, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartY, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartWidth, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartHeight) fits within the bounds of the original video frame.

StartY

Gets or sets the starting vertical position of the viewport rectangle in pixels.

public int StartY { get; set; }

Property Value

int

Remarks

Defines the top edge of the visible region at the beginning of the pan effect. The value represents the Y coordinate in pixels from the top edge of the original video frame.

When combined with VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopY, this creates vertical panning motion. If both values are equal, no vertical motion occurs (only horizontal motion and/or zoom).

Ensure the starting viewport rectangle remains within the bounds of the original video frame to avoid displaying empty areas.

StopHeight

Gets or sets the ending height of the viewport rectangle in pixels.

public int StopHeight { get; set; }

Property Value

int

Remarks

Defines the vertical size of the visible region at the end of the pan effect. This value, compared to VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartHeight, determines the vertical zoom behavior.

Zoom behavior based on height change:

  • StopHeight < StartHeight: Zoom in vertically (magnify, move closer)
  • StopHeight > StartHeight: Zoom out vertically (reduce, show more context)
  • StopHeight = StartHeight: No vertical zoom (only pan and/or horizontal zoom)

The viewport defined by VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopY + VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopHeight must not exceed the original video frame height.

StopWidth

Gets or sets the ending width of the viewport rectangle in pixels.

public int StopWidth { get; set; }

Property Value

int

Remarks

Defines the horizontal size of the visible region at the end of the pan effect. This value, compared to VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartWidth, determines the zoom behavior.

Zoom behavior based on width change:

  • StopWidth < StartWidth: Zoom in (magnify, move closer)
  • StopWidth > StartWidth: Zoom out (reduce, show more context)
  • StopWidth = StartWidth: No horizontal zoom (only pan and/or vertical zoom)

The viewport defined by VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopX + VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopWidth must not exceed the original video frame width.

StopX

Gets or sets the ending horizontal position of the viewport rectangle in pixels.

public int StopX { get; set; }

Property Value

int

Remarks

Defines the left edge of the visible region at the end of the pan effect. The value represents the X coordinate in pixels from the left edge of the original video frame.

The difference between VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopX and VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartX determines the amount and direction of horizontal panning. Larger values move the viewport to the right (panning right), smaller values move left (panning left).

Ensure the ending viewport (defined by VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopX, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopY, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopWidth, VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopHeight) fits within the bounds of the original video frame.

StopY

Gets or sets the ending vertical position of the viewport rectangle in pixels.

public int StopY { get; set; }

Property Value

int

Remarks

Defines the top edge of the visible region at the end of the pan effect. The value represents the Y coordinate in pixels from the top edge of the original video frame.

The difference between VisioForge.Core.Types.VideoEffects.VideoEffectPan.StopY and VisioForge.Core.Types.VideoEffects.VideoEffectPan.StartY determines the amount and direction of vertical panning. Larger values move the viewport down (panning down), smaller values move up (panning up).

Ensure the ending viewport rectangle remains within the bounds of the original video frame to avoid displaying empty areas.

Methods

GetEffectType()

Gets the specific type of this video effect.

public VideoEffectType GetEffectType()

Returns

VideoEffectType

Returns VisioForge.Core.Types.VideoEffects.VideoEffectType.Pan to identify this as an animated pan and zoom effect.

Remarks

This method is used by the video processing pipeline to route the effect to the appropriate pan processor, which handles the animated viewport transitions and applies the configured interpolation algorithm during rendering.