From b7e243e2613ff6a6018df119b4a8c2045b168cdd Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Thu, 3 Aug 2023 19:23:55 +0800 Subject: [PATCH] fix: fix the error of calcuating timeout --- .../vrender/perf-raf-based-sto_2023-08-03-11-24.json | 10 ++++++++++ packages/vrender/src/common/utils.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 common/changes/@visactor/vrender/perf-raf-based-sto_2023-08-03-11-24.json diff --git a/common/changes/@visactor/vrender/perf-raf-based-sto_2023-08-03-11-24.json b/common/changes/@visactor/vrender/perf-raf-based-sto_2023-08-03-11-24.json new file mode 100644 index 000000000..cbac3147c --- /dev/null +++ b/common/changes/@visactor/vrender/perf-raf-based-sto_2023-08-03-11-24.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@visactor/vrender", + "comment": "perf: enhance the effect of requestAnimationFrame in miniapp", + "type": "patch" + } + ], + "packageName": "@visactor/vrender" +} \ No newline at end of file diff --git a/packages/vrender/src/common/utils.ts b/packages/vrender/src/common/utils.ts index dd1f90a2b..81ed7a26f 100644 --- a/packages/vrender/src/common/utils.ts +++ b/packages/vrender/src/common/utils.ts @@ -352,7 +352,7 @@ export class RafBasedSTO { this.durations.shift(); } // 最多60fps - this.timeout = Math.min(this.durations.reduce((a, b) => a + b, 0) / this.durations.length, 1000 / 60); + this.timeout = Math.max(this.durations.reduce((a, b) => a + b, 0) / this.durations.length, 1000 / 60); } }