优化缩略图
This commit is contained in:
1 parent
fe4997f913
commit
c28adf9fae
21 files changed
+74
-24
No files matched your search
@@ -42,9 +42,21 @@ const DEFAULT_PRIORITY = 'resolution';
|
||||
const ANIMATED_OUTPUT_SIZES = [200, 400];
|
||||
const DEFAULT_OUTPUT_SIZE = 200;
|
||||
|
||||
/**
|
||||
* 「缩略图大小」输入框的默认建议值:每秒动画配 25 KB,夹在 25–100 KB 之间。
|
||||
* 只是打开面板时的初始值,用户随时可以手动改成 10–1024 之间的任意数。
|
||||
*/
|
||||
const SIZE_PER_SECOND = 25;
|
||||
const SIZE_SUGGESTION_RANGE = [25, 100];
|
||||
|
||||
// 相邻锚点之间插多少个采样点。数值越大,越容易压在目标体积附近,但粗估阶段耗时略增。
|
||||
const PATH_STEPS_PER_SEGMENT = 6;
|
||||
|
||||
function suggestSize(seconds) {
|
||||
const [min, max] = SIZE_SUGGESTION_RANGE;
|
||||
return Math.max(min, Math.min(max, Math.round((Number(seconds) || 0) * SIZE_PER_SECOND)));
|
||||
}
|
||||
|
||||
function animatedProfiles(priority, outputSize) {
|
||||
const limit = outputSize || DEFAULT_OUTPUT_SIZE;
|
||||
const plan = ANIMATED_PRIORITIES[priority] || ANIMATED_PRIORITIES[DEFAULT_PRIORITY];
|
||||
@@ -86,7 +98,10 @@ module.exports = {
|
||||
DEFAULT_PRIORITY,
|
||||
ANIMATED_OUTPUT_SIZES,
|
||||
DEFAULT_OUTPUT_SIZE,
|
||||
SIZE_PER_SECOND,
|
||||
SIZE_SUGGESTION_RANGE,
|
||||
PATH_STEPS_PER_SEGMENT,
|
||||
animatedProfiles,
|
||||
expandAnimatedPath,
|
||||
suggestSize,
|
||||
};
|
||||
Reference in new issue
Block a user