Skip to content

Commit

Permalink
Change default easeType from Linear to Smooth.
Browse files Browse the repository at this point in the history
  • Loading branch information
scottcgi committed Aug 16, 2021
1 parent 76ab28a commit 97201bd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
33 changes: 16 additions & 17 deletions Engine/Toolkit/Utils/Tween.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* CodeStyle: https://github.com/scottcgi/Mojoc/blob/master/Docs/CodeStyle.md
*
* Since : 2016-6-8
* Update : 2019-1-8
* Update : 2021-8-16
* Author : scott.cgi
*/

Expand Down Expand Up @@ -107,7 +107,7 @@ static TweenActionValue* AddTweenActionValue(TweenAction* action)
actionValue->OnGet = NULL;
actionValue->OnSet = NULL;
actionValue->isRelative = true;
actionValue->easeType = TweenEaseType_Linear;
actionValue->easeType = TweenEaseType_Smooth;

return actionValue;
}
Expand Down Expand Up @@ -187,6 +187,18 @@ static void* RunActions(Array(TweenAction*)* actions, void* tweenID)
}


static void RemoveActionByIndex(Tween* tween, TweenAction* action, int index)
{
if (action == tween->queueAction)
{
tween->queueAction = NULL;
}

AArrayList->RemoveByLast(tween->current, index);
AArrayList_Add(actionCacheList, action);
}


static bool TryRemoveAction(void* tweenID, TweenAction* action)
{
Tween* tween = AArrayIntMap_Get(tweenRunningMap, tweenID, Tween*);
Expand All @@ -199,14 +211,7 @@ static bool TryRemoveAction(void* tweenID, TweenAction* action)

if (action == tweenAction)
{
if (action == tween->queueAction)
{
tween->queueAction = NULL;
}

AArrayList->RemoveByLast(tween->current, i);
AArrayList_Add(actionCacheList, action);

RemoveActionByIndex(tween, action, i);
return true;
}
}
Expand Down Expand Up @@ -395,13 +400,7 @@ static void Update(float deltaSeconds)
action->OnComplete(action);
}

if (tween->queueAction == action)
{
tween->queueAction = NULL;
}

AArrayList->RemoveByLast(tween->current, j);
AArrayList_Add(actionCacheList, action);
RemoveActionByIndex(tween, action, j);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Engine/Toolkit/Utils/Tween.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ typedef struct
bool isRelative;

/**
* Default TweenEaseType_Linear.
* Default TweenEaseType_Smooth.
*/
TweenEaseType easeType;
}
Expand Down

0 comments on commit 97201bd

Please sign in to comment.