Handles smooth camera transitions and animations. More...
#include <CameraAnimator.h>
Public Types | |
enum class | EasingType { Linear , EaseInOut , EaseIn , EaseOut , EaseInOutQuad , EaseInOutCubic } |
Set the easing function type. More... | |
Public Member Functions | |
CameraAnimator (BaseCamera &camera) | |
Constructor. | |
void | Update (float deltaTime) |
Update the animation - call this every frame. | |
void | FocusOnPosition (const Vec3 &targetPosition, float duration=1.0f, std::function< void()> onComplete=nullptr) |
Smoothly focus the camera on a target position. | |
void | MoveTo (const Vec3 &newPosition, const Vec3 &newTarget, float duration=1.0f, std::function< void()> onComplete=nullptr) |
Smoothly move camera to a new position and target. | |
bool | IsAnimating () const |
Check if any animation is currently active. | |
void | StopAnimation () |
Stop any current animation. | |
void | SetEasingType (EasingType type) |
Set the easing type for animations. | |
Handles smooth camera transitions and animations.
This utility class provides smooth interpolated movements for camera operations like focusing on objects, transitioning between positions, and other animated camera behaviors.
|
strong |
CameraAnimator::CameraAnimator | ( | BaseCamera & | camera | ) |
Constructor.
camera | Reference to the camera to animate |
void CameraAnimator::FocusOnPosition | ( | const Vec3 & | targetPosition, |
float | duration = 1.0f , |
||
std::function< void()> | onComplete = nullptr |
||
) |
Smoothly focus the camera on a target position.
targetPosition | The position to focus on |
duration | How long the animation should take (in seconds) |
onComplete | Optional callback when animation completes |
|
inline |
Check if any animation is currently active.
void CameraAnimator::MoveTo | ( | const Vec3 & | newPosition, |
const Vec3 & | newTarget, | ||
float | duration = 1.0f , |
||
std::function< void()> | onComplete = nullptr |
||
) |
Smoothly move camera to a new position and target.
newPosition | New camera position |
newTarget | New camera target |
duration | How long the animation should take (in seconds) |
onComplete | Optional callback when animation completes |
|
inline |
Set the easing type for animations.
type | The easing type to use |
void CameraAnimator::StopAnimation | ( | ) |
Stop any current animation.
void CameraAnimator::Update | ( | float | deltaTime | ) |
Update the animation - call this every frame.
deltaTime | Time elapsed since last frame in seconds |