mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Handle the case of zero delta time on iOS (#6926)
This commit is contained in:
committed by
GitHub
parent
4c9067b394
commit
4e208bb970
@@ -45,7 +45,9 @@ export class CrossFade extends Playable {
|
||||
for (let iFading = 0; iFading < this._fadings.length; ++iFading) {
|
||||
const fading = this._fadings[iFading];
|
||||
fading.easeTime += deltaTime;
|
||||
const relativeWeight = clamp01(fading.easeTime / fading.easeDuration);
|
||||
// We should properly handle the case of
|
||||
// `fading.easeTime === 0 && fading.easeDuration === 0`, which yields `NaN`.
|
||||
const relativeWeight = fading.easeDuration === 0 ? 1 : clamp01(fading.easeTime / fading.easeDuration);
|
||||
const weight = relativeWeight * absoluteWeight;
|
||||
absoluteWeight = absoluteWeight * (1.0 - relativeWeight);
|
||||
if (fading.target.state) {
|
||||
|
||||
Reference in New Issue
Block a user