@@ -52,18 +52,18 @@ async function card(data: GetData, uiConfig: UiConfig): Promise<string> {
52
52
}
53
53
54
54
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 ? 225 : 20 ,
59
- dataXAngle : isRtlDirection ? 25 : 220 ,
60
- iconXAngle : isRtlDirection ? 235 : - 5 ,
61
- imageXAngle : isDisabledAnimations ? 122 : 127 ,
62
- imageYAngle : isDisabledAnimations ? 70 : 65 ,
63
- userXAngle : isDisabledAnimations ? 122 : 112 ,
64
- userYAngle : isDisabledAnimations ? 140 : 130 ,
65
- follXAngle : isDisabledAnimations ? 122 : 112 ,
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 ,
67
67
} ;
68
68
69
69
const hideStroke = parseBoolean ( uiConfig . hideStroke ) ? `` : `stroke="#${ uiConfig . strokeColor } " stroke-width="5"` ;
@@ -104,7 +104,7 @@ async function card(data: GetData, uiConfig: UiConfig): Promise<string> {
104
104
105
105
.image-profile-animation {
106
106
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;
108
108
}
109
109
110
110
.single-item-animation {
@@ -138,11 +138,11 @@ async function card(data: GetData, uiConfig: UiConfig): Promise<string> {
138
138
const cardItemsSVG = cardItemsToShow . map ( ( item , index ) => `
139
139
<g transform="translate(230, ${ 15 + index * 25 } )">
140
140
<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">
142
142
${ item . icon }
143
143
</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>
146
146
</g>
147
147
</g>
148
148
` ) . join ( "\n" ) ;
@@ -232,19 +232,19 @@ async function card(data: GetData, uiConfig: UiConfig): Promise<string> {
232
232
${ backgroundSVG }
233
233
<g transform="translate(0, 25)">
234
234
<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>
236
236
</g>
237
237
<g class="image-profile-animation">
238
238
<defs>
239
239
<pattern id="image" x="0%" y="0%" height="100%" width="100%" viewBox="0 0 512 512">
240
240
<image x="0%" y="0%" width="512" height="512" href="data:image/jpeg;base64,${ dataPicture } "></image>
241
241
</pattern>
242
242
</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 } />
244
244
</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>
246
246
<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>
248
248
</g>
249
249
${ cardItemsSVG }
250
250
</g>
0 commit comments