Skip to content

Commit 97201bd

Browse files
committed
Change default easeType from Linear to Smooth.
1 parent 76ab28a commit 97201bd

File tree

2 files changed

+17
-18
lines changed

2 files changed

+17
-18
lines changed

Engine/Toolkit/Utils/Tween.c

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* CodeStyle: https://github.com/scottcgi/Mojoc/blob/master/Docs/CodeStyle.md
1010
*
1111
* Since : 2016-6-8
12-
* Update : 2019-1-8
12+
* Update : 2021-8-16
1313
* Author : scott.cgi
1414
*/
1515

@@ -107,7 +107,7 @@ static TweenActionValue* AddTweenActionValue(TweenAction* action)
107107
actionValue->OnGet = NULL;
108108
actionValue->OnSet = NULL;
109109
actionValue->isRelative = true;
110-
actionValue->easeType = TweenEaseType_Linear;
110+
actionValue->easeType = TweenEaseType_Smooth;
111111

112112
return actionValue;
113113
}
@@ -187,6 +187,18 @@ static void* RunActions(Array(TweenAction*)* actions, void* tweenID)
187187
}
188188

189189

190+
static void RemoveActionByIndex(Tween* tween, TweenAction* action, int index)
191+
{
192+
if (action == tween->queueAction)
193+
{
194+
tween->queueAction = NULL;
195+
}
196+
197+
AArrayList->RemoveByLast(tween->current, index);
198+
AArrayList_Add(actionCacheList, action);
199+
}
200+
201+
190202
static bool TryRemoveAction(void* tweenID, TweenAction* action)
191203
{
192204
Tween* tween = AArrayIntMap_Get(tweenRunningMap, tweenID, Tween*);
@@ -199,14 +211,7 @@ static bool TryRemoveAction(void* tweenID, TweenAction* action)
199211

200212
if (action == tweenAction)
201213
{
202-
if (action == tween->queueAction)
203-
{
204-
tween->queueAction = NULL;
205-
}
206-
207-
AArrayList->RemoveByLast(tween->current, i);
208-
AArrayList_Add(actionCacheList, action);
209-
214+
RemoveActionByIndex(tween, action, i);
210215
return true;
211216
}
212217
}
@@ -395,13 +400,7 @@ static void Update(float deltaSeconds)
395400
action->OnComplete(action);
396401
}
397402

398-
if (tween->queueAction == action)
399-
{
400-
tween->queueAction = NULL;
401-
}
402-
403-
AArrayList->RemoveByLast(tween->current, j);
404-
AArrayList_Add(actionCacheList, action);
403+
RemoveActionByIndex(tween, action, j);
405404
}
406405
}
407406
}

Engine/Toolkit/Utils/Tween.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ typedef struct
7272
bool isRelative;
7373

7474
/**
75-
* Default TweenEaseType_Linear.
75+
* Default TweenEaseType_Smooth.
7676
*/
7777
TweenEaseType easeType;
7878
}

0 commit comments

Comments
 (0)