mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 13:53:52 +02:00
Boops
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user