@@ -52,18 +52,18 @@ async function card(data: GetData, uiConfig: UiConfig): Promise<string> {
5252 }
5353
5454 const direction = isRtlDirection ? "rtl" : "ltr" ;
55- const angle = {
56- titleXAngle : isDisabledAnimations ? ( isRtlDirection ? 520 : 15 ) : ( isRtlDirection ? 510 : 5 ) ,
57- titleYAngle : isDisabledAnimations ? 0 : - 10 ,
58- textXAngle : isRtlDirection ? 215 : 20 ,
59- dataXAngle : isRtlDirection ? 15 : 220 ,
60- iconXAngle : isRtlDirection ? 225 : - 5 ,
61- imageXAngle : isDisabledAnimations ? 120 : 125 ,
62- imageYAngle : isDisabledAnimations ? 70 : 65 ,
63- userXAngle : isDisabledAnimations ? 119.9 : 109.9 ,
64- userYAngle : isDisabledAnimations ? 140 : 130 ,
65- follXAngle : isDisabledAnimations ? 120 : 110 ,
66- follYAngle : isDisabledAnimations ? 161 : 151 ,
55+ const position = {
56+ titleXPosition : isDisabledAnimations ? ( isRtlDirection ? 520 : 15 ) : ( isRtlDirection ? 510 : 5 ) ,
57+ titleYPosition : isDisabledAnimations ? 0 : - 10 ,
58+ textXPosition : isRtlDirection ? 225 : 20 ,
59+ dataXPosition : isRtlDirection ? 25 : 220 ,
60+ iconXPosition : isRtlDirection ? 235 : - 5 ,
61+ imageXPosition : isDisabledAnimations ? 122 : 127 ,
62+ imageYPosition : isDisabledAnimations ? 70 : 65 ,
63+ userXPosition : isDisabledAnimations ? 122 : 112 ,
64+ userYPosition : isDisabledAnimations ? 140 : 130 ,
65+ follXPosition : isDisabledAnimations ? 122 : 112 ,
66+ follYPosition : isDisabledAnimations ? 161 : 151 ,
6767 } ;
6868
6969 const hideStroke = parseBoolean ( uiConfig . hideStroke ) ? `` : `stroke="#${ uiConfig . strokeColor } " stroke-width="5"` ;
@@ -104,7 +104,7 @@ async function card(data: GetData, uiConfig: UiConfig): Promise<string> {
104104
105105 .image-profile-animation {
106106 animation: scaleInAnimation 1.2s ease-in-out forwards;
107- transform-origin: ${ angle . imageXAngle } px ${ angle . imageYAngle } px;
107+ transform-origin: ${ position . imageXPosition } px ${ position . imageYPosition } px;
108108 }
109109
110110 .single-item-animation {
@@ -138,11 +138,11 @@ async function card(data: GetData, uiConfig: UiConfig): Promise<string> {
138138 const cardItemsSVG = cardItemsToShow . map ( ( item , index ) => `
139139 <g transform="translate(230, ${ 15 + index * 25 } )">
140140 <g class="single-item-animation" style="animation-delay: ${ 210 + index * 100 } ms" transform="translate(25, 0)">
141- <svg x="${ angle . iconXAngle } " y="0" class="icon" viewBox="0 0 16 16" version="1.1" width="16" height="16">
141+ <svg x="${ position . iconXPosition } " y="0" class="icon" viewBox="0 0 16 16" version="1.1" width="16" height="16">
142142 ${ item . icon }
143143 </svg>
144- <text class="text" x="${ angle . textXAngle } " y="12.5">${ item . text } :</text>
145- <text class="text text-bold" x="${ angle . dataXAngle } " y="12.5">${ item . value } </text>
144+ <text class="text" x="${ position . textXPosition } " y="12.5">${ item . text } :</text>
145+ <text class="text text-bold" x="${ position . dataXPosition } " y="12.5">${ item . value } </text>
146146 </g>
147147 </g>
148148 ` ) . join ( "\n" ) ;
@@ -232,19 +232,19 @@ async function card(data: GetData, uiConfig: UiConfig): Promise<string> {
232232 ${ backgroundSVG }
233233 <g transform="translate(0, 25)">
234234 <g class="div-animation">
235- <text x="${ angle . titleXAngle } " y="${ angle . titleYAngle } " class="text-title">${ titleCard } </text>
235+ <text x="${ position . titleXPosition } " y="${ position . titleYPosition } " class="text-title">${ titleCard } </text>
236236 </g>
237237 <g class="image-profile-animation">
238238 <defs>
239239 <pattern id="image" x="0%" y="0%" height="100%" width="100%" viewBox="0 0 512 512">
240240 <image x="0%" y="0%" width="512" height="512" href="data:image/jpeg;base64,${ dataPicture } "></image>
241241 </pattern>
242242 </defs>
243- <circle cx="${ angle . imageXAngle } " cy="${ angle . imageYAngle } " r="50" fill="url(#image)" ${ hideStroke } />
243+ <circle cx="${ position . imageXPosition } " cy="${ position . imageYPosition } " r="50" fill="url(#image)" ${ hideStroke } />
244244 </g>
245- <text x="${ angle . userXAngle } " y="${ angle . userYAngle } " direction="ltr" class="text-username div-animation">@${ data . username } </text>
245+ <text x="${ position . userXPosition } " y="${ position . userYPosition } " direction="ltr" class="text-username div-animation">@${ data . username } </text>
246246 <g class="div-animation text-middle">
247- <text x="${ angle . follXAngle } " y="${ angle . follYAngle } " class="text-followers"><tspan class="text-bold">${ data . followers } </tspan> ${ selectLocale . followersText || defaultLocale . followersText } · <tspan class="text-bold">${ data . following } </tspan> ${ selectLocale . followingText || defaultLocale . followingText } </text>
247+ <text x="${ position . follXPosition } " y="${ position . follYPosition } " class="text-followers"><tspan class="text-bold">${ data . followers } </tspan> ${ selectLocale . followersText || defaultLocale . followersText } · <tspan class="text-bold">${ data . following } </tspan> ${ selectLocale . followingText || defaultLocale . followingText } </text>
248248 </g>
249249 ${ cardItemsSVG }
250250 </g>
0 commit comments