mirror of
https://github.com/LNH-team/pico-launcher.git
synced 2026-06-02 09:06:54 +02:00
Initial commit
This commit is contained in:
35
arm9/source/animation/Animator.cpp
Normal file
35
arm9/source/animation/Animator.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "common.h"
|
||||
#include "core/math/fixed.h"
|
||||
#include "Animator.h"
|
||||
|
||||
template <>
|
||||
bool Animator<int>::Update()
|
||||
{
|
||||
if (++_frame >= _duration)
|
||||
{
|
||||
_frame = _duration;
|
||||
_value = _to;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto relativePos = _curve->Compute(_frame * _invDuration);
|
||||
_value = _from + (relativePos.LongMul(_to - _from) + 0.5).Int();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool Animator<fix32<12>>::Update()
|
||||
{
|
||||
if (++_frame >= _duration)
|
||||
{
|
||||
_frame = _duration;
|
||||
_value = _to;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto relativePos = _curve->Compute(_frame * _invDuration);
|
||||
_value = _from + fix32<12>(relativePos.LongMul(_to - _from));
|
||||
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user