Skip to content

Commit bfa9903

Browse files
authored
Update print statement from 'Hello' to 'Goodbye'
1 parent 3f5c7c5 commit bfa9903

1 file changed

Lines changed: 84 additions & 43 deletions

File tree

utils/theSystem.js

Lines changed: 84 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,4 @@
1-
const { wrapSVGText, capitalize } = require("./allFunction");
2-
3-
function escapeXML(str = "") {
4-
return String(str)
5-
.replace(/&/g, "&")
6-
.replace(/</g, "&lt;")
7-
.replace(/>/g, "&gt;");
8-
}
9-
10-
function svgMultiline(text, lineHeight = 18) {
11-
return escapeXML(text)
12-
.split('\n')
13-
.map((line, i) => `<tspan x="0" dy="${i === 0 ? 0 : lineHeight}">${line}</tspan>`)
14-
.join('');
15-
}
1+
const { wrapSVGText, capitalize, escapeXML, svgMultiline, wrapSVGTextCenter } = require("./allFunction");
162

173

184

@@ -74,7 +60,6 @@ function generateErrorSVG(
7460
<text class="sub" x="0" y="20">${svgMultiline(desc)}</text>
7561
</g>
7662
</g>
77-
7863
</svg>`;
7964
}
8065

@@ -84,9 +69,9 @@ function generateErrorSVG(
8469

8570
/**
8671
* Generate SVG Card
87-
* @param {string} image - The Avatar Image in Base64
88-
* @param {string} name - The Github account name
89-
* @param {string} desc - The Description or Bio
72+
* @param {string} image - User Github Image
73+
* @param {string} name - User Github Name
74+
* @param {string} desc - Description or Github Bio
9075
* @param {number} age - The Age.
9176
* @param {string} study - The Study.
9277
* @param {number} religion - The religion.
@@ -100,10 +85,10 @@ function generateErrorSVG(
10085
* @param {string} location - The Adress
10186
* @param {number} totalPullRequests - Github Pull Request
10287
* @param {number} followers - Github Follower
103-
* @returns {string} - SVG dalam bentuk string
88+
* @returns {string} - SVG on string data type
10489
*/
10590

106-
function generateSVG(
91+
function generateSVGOne(
10792
image = "",
10893
name = "Not Found",
10994
desc = wrapSVGText("None", 50, 17),
@@ -127,7 +112,9 @@ function generateSVG(
127112
const descId = `desc-${uid}`;
128113

129114
age = (typeof age === "number") ? age : "Private";
130-
number = (typeof number === "number") ? `+${number}` : "Private";
115+
if (number && /^\d+$/.test(number)) number = `+${number}`;
116+
else number = "Private";
117+
131118

132119
const svg = `
133120
<svg width="600" height="600" xmlns="http://www.w3.org/2000/svg">
@@ -430,18 +417,35 @@ function generateSVG(
430417
return svg;
431418
}
432419

433-
function generateSVG2(
420+
/**
421+
* @param {string} image - User Github Image
422+
* @param {string} name - User Github Name
423+
* @param {string} desc - Description or Github Bio
424+
* @param {number} totalStars - Github Star
425+
* @param {number} totalRepos - Github Repositories
426+
* @param {number} totalIssues - Github Issue
427+
* @param {string} location - The Adress
428+
* @param {number} totalPullRequests - Github Pull Request
429+
* @param {number} followers - Github Follower
430+
* @returns {string} - SVG on string data type
431+
*/
432+
433+
function generateSVGTwo(
434434
image = "",
435435
name = "Not Found",
436-
desc = wrapSVGText("None", 50, 17)
436+
desc = wrapSVGTextCenter(`None`, 600, 75, 40, 18)
437437
) {
438438

439439
const uid = Date.now().toString(36);
440440
const titleId = `title-${uid}`;
441441
const descId = `desc-${uid}`;
442442

443+
444+
443445
const svg = `
444-
<svg width="500" height="200" viewBox="0 0 500 200" xmlns="http://www.w3.org/2000/svg">
446+
<svg width="800" height="150" viewBox="0 0 800 150" xmlns="http://www.w3.org/2000/svg">
447+
<title id="${titleId}">${escapeXML("Lemon Card - SVG Card")}</title>
448+
<desc id="${descId}">${escapeXML("LemonSync")}</desc>
445449
<defs>
446450
<filter id="shadow" x="-50%" y="-50%" width="200%" height="200%">
447451
<feGaussianBlur in="SourceAlpha" stdDeviation="5" result="blur"/>
@@ -453,8 +457,13 @@ function generateSVG2(
453457
</filter>
454458
455459
<style>
456-
@keyframes slideIn {
457-
0% { transform: translateX(-100px); opacity: 0; }
460+
@keyframes slideInLeft {
461+
0% { transform: translateX(-50px); opacity: 0; }
462+
100% { transform: translateX(0); opacity: 1; }
463+
}
464+
465+
@keyframes slideInRight {
466+
0% { transform: translateX(+50px); opacity: 0; }
458467
100% { transform: translateX(0); opacity: 1; }
459468
}
460469
@@ -463,12 +472,26 @@ function generateSVG2(
463472
50% { filter: drop-shadow(0 0 20px #00ff00); }
464473
}
465474
475+
.fade-up {
476+
transform-box: fill-box;
477+
transform-origin: center;
478+
opacity: 0;
479+
animation: slideInLeft 1.5s forwards ease-out;
480+
}
481+
482+
.del-star { animation-delay: 0.6s; }
483+
.del-repo { animation-delay: 0.7s; }
484+
.del-issue { animation-delay: 0.8s; }
485+
.del-loc { animation-delay: 0.9s; }
486+
.del-pull { animation-delay: 1s; }
487+
.del-follow { animation-delay: 1.1s; }
488+
466489
.animated-img {
467-
animation: slideIn 1.5s ease-out forwards;
490+
animation: slideInLeft 1.5s ease-out forwards;
468491
}
469492
470493
.animated-frame {
471-
animation: slideIn 1.5s ease-out forwards, glowAnimation 2s infinite;
494+
animation: slideInLeft 1.5s ease-out forwards, glowAnimation 2s infinite;
472495
}
473496
474497
.profile-text {
@@ -478,7 +501,17 @@ function generateSVG2(
478501
fill: #ffffff;
479502
text-anchor: middle;
480503
opacity: 0;
481-
animation: slideIn 1.5s ease-out forwards;
504+
animation: slideInLeft 1.5s ease-out forwards;
505+
}
506+
507+
.desc-text {
508+
font-family: Arial, sans-serif;
509+
font-style: italic;
510+
font-size: 16px;
511+
fill: #ffffff;
512+
text-anchor: start;
513+
opacity: 0;
514+
animation: slideInRight 1.5s ease-out forwards;
482515
}
483516
</style>
484517
</defs>
@@ -487,22 +520,30 @@ function generateSVG2(
487520
<rect x="50%" y="0" width="50%" height="100%" fill="#216038" />
488521
<rect x="49%" y="0" width="2%" height="100%" fill="black" opacity="0.3" filter="url(#shadow)" />
489522
490-
<circle cx="125" cy="70" r="40" fill="url(#imgPattern)" class="animated-img" />
491-
<!-- Bingkai bulat -->
492-
<circle cx="125" cy="70" r="42" fill="none" stroke="#00ff00" stroke-width="4" class="animated-frame" />
493-
494-
<text x="125" y="135" class="profile-text">${name.toUpperCase()}</text>
495-
496-
<defs>
497-
<pattern id="imgPattern" patternUnits="userSpaceOnUse" width="80" height="80">
498-
<image href="https://via.placeholder.com/80" x="0" y="0" width="80" height="80" />
499-
</pattern>
500-
</defs>
523+
<circle cx="200" cy="60" r="40" fill="url(#imgPattern)" class="animated-img" />
524+
<circle cx="200" cy="60" r="42" fill="none" stroke="#00ff00" stroke-width="4" class="animated-frame" />
525+
526+
<defs>
527+
<pattern id="imgPattern"
528+
patternUnits="objectBoundingBox"
529+
patternContentUnits="objectBoundingBox"
530+
width="1"
531+
height="1">
532+
<image href="data:image/png;base64,${image}"
533+
preserveAspectRatio="xMidYMid slice"
534+
x="0"
535+
y="0"
536+
width="1"
537+
height="1" />
538+
</pattern>
539+
</defs>
540+
541+
<text x="200" y="125" class="profile-text">${name.toUpperCase()}</text>
542+
<text x="100" y="135" class="desc-text">${desc}</text>
501543
</svg>
502-
503544
`;
504545

505546
return svg;
506547
}
507548

508-
module.exports = { generateErrorSVG, generateSVG, generateSVG2 }
549+
module.exports = { generateErrorSVG, generateSVGOne, generateSVGTwo }

0 commit comments

Comments
 (0)