MCPcopy Create free account
hub / github.com/defold/defold / SetNodeFlipbookCursor

Function SetNodeFlipbookCursor

engine/gui/src/gui.cpp:3601–3621  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3599 }
3600
3601 void SetNodeFlipbookCursor(HScene scene, HNode node, float cursor)
3602 {
3603 InternalNode* n = GetNode(scene, node);
3604
3605 cursor = dmMath::Clamp(cursor, 0.0f, 1.0f);
3606 n->m_Node.m_FlipbookAnimPosition = cursor;
3607 if (n->m_Node.m_FlipbookAnimHash) {
3608 Animation* anim = GetComponentAnimation(scene, node, &n->m_Node.m_FlipbookAnimPosition);
3609 if (anim) {
3610
3611 if (anim->m_Playback == PLAYBACK_ONCE_BACKWARD || anim->m_Playback == PLAYBACK_LOOP_BACKWARD)
3612 {
3613 cursor = 1.0f - cursor;
3614 } else if (anim->m_Playback == PLAYBACK_ONCE_PINGPONG || anim->m_Playback == PLAYBACK_LOOP_PINGPONG) {
3615 cursor /= 2.0f;
3616 }
3617
3618 anim->m_Elapsed = cursor * anim->m_Duration;
3619 }
3620 }
3621 }
3622
3623 float GetNodeFlipbookPlaybackRate(HScene scene, HNode node)
3624 {

Callers 1

LuaSetFlipbookCursorFunction · 0.70

Calls 3

GetNodeFunction · 0.70
GetComponentAnimationFunction · 0.70
ClampFunction · 0.50

Tested by

no test coverage detected