Skip to content
Half People edited this page Apr 13, 2024 · 12 revisions

Welcome to the HImGuiAnimation wiki!

BaceFunction

Only two main functions need to be used in this library HAnimationSystem::Play HAnimationSystem::updata

1.HAnimationSystem::Play

This function has communicated with the bottom layer and will automatically dispatch the queue for you (repeated triggering will ignore your trigger when playback is not completed. Of course, if you want, you can stop playback manually)

//callback (Animation overprocessed.See AnimationPlayerCallBack comments for details) 
//MaxFrame (The largest Frame among animations)
//value (The value transferred to the callback)
//out (Animation sequence returns)
//speed (Play speed)
//FPS (Max FPS : Lift (-1) )
//IsLoop (keep looping)
HAnimationSystem::Play(PlayerCallBack::AnimationPlayerCallBack callback, size_t MaxFrame, HValue value = nullptr, HAnimationSystem::AnimationSequence** out = 0, float speed = 5, int FPS = 60, bool IsLoop = false)

2.HAnimationSystem::updata

//Animation Manager Update (used in main loop)
//delta_time (Please use ImGui to obtain  ImGui::GetIO().DeltaTime)
void updata(float delta_time);
//- Animation Manager Update (used in main loop)(Manager FPS limit, Animation sequences will be disabled FPS limit)
//- Recommended Use : void updata(float delta_time);
void updata(float delta_time, int MaxFPS);

3.HAnimationSystem::PlayerCallBack::AnimationPlayerCallBack

This one is the function callback for HAnimationSystem::Play

//example : function callback
void Sequencer(int32_t Frame, HAnimationSystem::HValue value)
{
	const std::vector<int> keys = { 0 , 30 , 64 };
	const std::vector<float> values = { 80,200,80 };

	HAnimationSystem::PlayerCallBack::HInterpolationInfo info = HAnimationSystem::PlayerCallBack::GetInterpolationInfoFromKeys(keys, Frame);
	HAnimationSystem::HValue_Get<float>(value) = HAnimationSystem::PlayerCallBack::LinearInterpolation(values[info.PreviousKey], values[info.LastOneKey], info.alpha);//There are many plug-in tools in `HAnimationSystem::PlayerCallBack`. Of course, you can write your own
}

... 
HAnimationSystem::Play(Sequencer, ...);
Clone this wiki locally