This commit is contained in:
Natsumi
2025-10-17 16:57:09 +11:00
parent 9e95e1734c
commit dc51d156e4
13 changed files with 386 additions and 330 deletions

View File

@@ -9,6 +9,7 @@ import {
useSearchStore,
useWorldStore
} from '../../stores';
import { AppDebug } from '../../service/appConfig.js';
import { compareUnityVersion } from './avatar';
import { escapeTag } from './base/string';
import { miscRequest } from '../../api';
@@ -213,7 +214,7 @@ function convertFileUrlToImageUrl(url, resolution = 128) {
if (match) {
const fileId = match[1];
const version = match[2];
return `https://api.vrchat.cloud/api/1/image/file_${fileId}/${version}/${resolution}`;
return `${AppDebug.endpointDomain}/image/file_${fileId}/${version}/${resolution}`;
}
// no match return origin url
return url;

View File

@@ -54,4 +54,34 @@ function getEmojiFileName(emoji) {
}
}
export { getPrintLocalDate, getPrintFileName, getEmojiFileName };
/**
* @param {string} url
* @param {number} fps
* @param {number} frameCount
* @param {string} loopStyle
*/
function generateEmojiStyle(url, fps, frameCount, loopStyle) {
let framesPerLine = 2;
if (frameCount > 4) framesPerLine = 4;
if (frameCount > 16) framesPerLine = 8;
const animationDurationMs = (1000 / fps) * frameCount;
const frameSize = 1024 / framesPerLine;
const scale = 100 / (frameSize / 200);
const animStyle = loopStyle === 'pingpong' ? 'alternate' : 'none';
const style = `
transform: scale(${scale / 100});
transform-origin: top left;
width: ${frameSize}px;
height: ${frameSize}px;
background: url('${url}') 0 0;
animation: ${animationDurationMs}ms steps(1) 0s infinite ${animStyle} running animated-emoji-${frameCount};
`;
return style;
}
export {
getPrintLocalDate,
getPrintFileName,
getEmojiFileName,
generateEmojiStyle
};