mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-28 19:25:38 +00:00
ae7c9dabb8
Also did some code cleanup.
41 lines
968 B
C++
41 lines
968 B
C++
// SPDX-License-Identifier: MIT
|
|
//
|
|
// EmulationStation Desktop Edition
|
|
// MoveCameraAnimation.h
|
|
//
|
|
// Animation to play when moving the camera, used by the slide transition style.
|
|
//
|
|
|
|
#ifndef ES_APP_ANIMATIONS_MOVE_CAMERA_ANIMATION_H
|
|
#define ES_APP_ANIMATIONS_MOVE_CAMERA_ANIMATION_H
|
|
|
|
#include "animations/Animation.h"
|
|
|
|
class MoveCameraAnimation : public Animation
|
|
{
|
|
public:
|
|
MoveCameraAnimation(
|
|
Transform4x4f& camera,
|
|
const Vector3f& target)
|
|
: mCameraStart(camera),
|
|
mTarget(target),
|
|
cameraOut(camera) {}
|
|
|
|
int getDuration() const override { return 400; }
|
|
|
|
void apply(float t) override
|
|
{
|
|
// Cubic ease out.
|
|
t -= 1;
|
|
cameraOut.translation() = -Vector3f().lerp(-mCameraStart.translation(), mTarget, t*t*t + 1);
|
|
}
|
|
|
|
private:
|
|
Transform4x4f mCameraStart;
|
|
Vector3f mTarget;
|
|
|
|
Transform4x4f& cameraOut;
|
|
};
|
|
|
|
#endif // ES_APP_ANIMATIONS_MOVE_CAMERA_ANIMATION_H
|