-
Notifications
You must be signed in to change notification settings - Fork 0
/
mycodingplayground2.html
320 lines (299 loc) · 16.8 KB
/
mycodingplayground2.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description"
content="This programming portfolio was created to find new, interesting opportunities and to visualize my development from a curious coder to a full-stack developer." />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="css/styles_template2.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<title>Sara's Programming Portfolio | sarasjodin.com</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div class="container-fluid">
<a class="navbar-brand" href="index.html#welcome">Sara Sjodin Scolari</a>
<button class="navbar-toggler" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvasDarkNavbar"
aria-controls="offcanvasDarkNavbar" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="offcanvas offcanvas-end text-bg-dark" tabindex="-1" id="offcanvasDarkNavbar"
aria-labelledby="offcanvasDarkNavbarLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="offcanvasDarkNavbarLabel">Sara Sjodin Scolari</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas"
aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<ul class="navbar-nav justify-content-end flex-grow-1 pe-3">
<li class="nav-item">
<a class="nav-link" href="index.html#welcome" title="Visit Home" id="home-link">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html#about" title="Visit the About section"
id="about-link">About
Me</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link active dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"
aria-expanded="false">
My Portfolio
</a>
<ul class="dropdown-menu dropdown-menu-dark">
<li><a class="dropdown-item" target="_blank" href="index.html#portfolio"
title="Visit the Portfolio section" id="portfolio-link">My Portfolio section</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" target="_blank" href="https://climasense.netlify.app"
title="Visit my Weather app" id="weatherapp-link">OpenWeather API app</a></li>
<li><a class="dropdown-item" target="_blank" href="https://timezonesclocks.netlify.app"
title="Visit my World Clocks' app" id="worldclocks-link">Worlds' Clocks app</a>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item" href="mycodingplayground1.html" title="Visit one of my Playground experimental pages"
id="playground1-link">Experiment animated
SVGs</a></li>
<li><a class="dropdown-item" href="mycodingplayground2.html" title="Visit one of my Playground experimental pages"
id="playground2-link">Experiment animated
charts</a></li>
</ul>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html#contact" title="Visit the Contact section"
id="contact-link">Contact Me</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html#future-projects" title="Visit the Future projects section"
id="projects-link">My Future projects</a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.html#learning-path" title="Visit the Learning path section"
id="learning-link">My
Learning path</a>
</li>
</ul>
</div>
</div>
</div>
</nav>
<section id="welcome" class="gradient-section">
<div class="container align-self-center">
<h1>Experimental page | Animated SVG charts</h1>
<p>With this page I just want to:
<ul>
<li>Test some coding ideas and experiment</li>
<li>Show my interests and diverse potential</li>
</ul>
<p>If you get some ideas after visiting this page - <a href="index.html#contact"
title="Visit the Contact section"><b>please
contact
me!</b></a></p>
<p>I also have a website showcasing my current offering as a digital consultant:
<br><a href="https://sarasjodin.com" title="Visit sarasjodin.com's homepage"
target="_blank"><b>sarasjodin.com</b></a>
</p>
</div>
</section>
<section id="playground-template">
<div class="container non-gradient-section last-container">
<div class="row">
<div class="col-md-12">
<h2>Animated SVG charts</h2>
<div>
<div class="row">
<div class="col-md-4 d-flex justify-content-center align-items-center">
<div class="chart-wrapper">
<svg class="circle-fill" width="200" height="200">
<circle class="circle-color" id="doughnut-chart-3" data-percentage="55" cx="100"
cy="100" r="100" fill="whitesmoke" />
<path class="chart-path" fill="gold" />
<circle cx="100" cy="100" r="75" fill="white" />
<text class="chart-text" x="100" y="100">55%</text>
<defs>
<clipPath id="id1">
<circle cx="100" cy="100" r="75" />
</clipPath>
</defs>
</svg>
</div>
</div>
<div class="col-md-4 d-flex justify-content-center align-items-center">
<div class="chart-wrapper">
<svg class="circle-fill" width="200" height="200">
<circle class="circle-color" id="doughnut-chart-1" data-percentage="95" cx="100"
cy="100" r="100" fill="whitesmoke" />
<path class="chart-path" fill="silver" />
<circle cx="100" cy="100" r="75" fill="white" />
<text class="chart-text" x="100" y="100">95%</text>
<defs>
<clipPath id="circle-clip2">
<circle cx="100" cy="100" r="75" />
</clipPath>
</defs>
</svg>
</div>
</div>
<div class="col-md-4 d-flex justify-content-center align-items-center">
<div class="chart-wrapper">
<svg class="circle-fill" width="200" height="200">
<circle class="circle-color" id="doughnut-chart-2" data-percentage="45" cx="100"
cy="100" r="100" fill="whitesmoke" />
<path class="chart-path" fill="orange" />
<circle cx="100" cy="100" r="75" fill="white" />
<text class="chart-text" x="100" y="100">45%</text>
<defs>
<clipPath id="circle-clip3">
<circle cx="100" cy="100" r="75" />
</clipPath>
</defs>
</svg>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<p>Doughnut charts created by me with HTML, CSS & JavaScript
</p>
</div>
<br>
<br>
<div class="row">
<div class="col-md-4">
<p>Experience the enchantment of animated charts that spring to life the moment the page
loads.</p>
</div>
<div class="col-md-4">
<p>But
the excitement doesn't
end there - simply <strong>hover your mouse over these charts</strong>, and watch them react
and dazzle
in
response.</p>
</div>
<div class="col-md-4">
<p>For those on phones
or tablets, <strong>tap on the chart to unleash the magic, and then tap outside</strong> to
witness the
spectacle.
Go ahead, give it a try!</p>
</div>
<div class="row">
<a href="mycodingplayground1.html" title="Visit my svg animation test">View my animated
illustration experiment</a>
<br>
<a href="index.html#portfolio" title="Return to my main Portfolio section">Return to my
main
Portfolio section</a>
</div>
</div>
</div>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="footer-content">
<div class="footer-links">
<h3>Explore</h3>
<ul>
<li><a href="index.html#welcome" title="Visit Home">Welcome</a></li>
<li><a href="index.html#about" title="Visit the About section">About Me</a></li>
<li><a href="index.html#portfolio" title="Visit the Portfolio section">My Portfolio</a></li>
<li><a href="index.html#contact" title="Visit the Contact section">Contact Me</a></li>
</ul>
</div>
<div class="footer-links">
<h3>More</h3>
<ul>
<li><a href="index.html#future-projects" title="Visit the Future projects section">My Future
projects</a>
</li>
<li><a href="index.html#learning-path" title="Visit the Learning path section">My Learning
path</a></li>
</ul>
</div>
<div class="footer-social">
<h3>Connect</h3>
<ul>
<li><a href="https://www.linkedin.com/in/sjodinscolari/" target="_blank"
title="Visit Sara on LinkedIn"><i class="fab fa-linkedin"></i></a></li>
</ul>
</div>
</div>
<div class="footer-info">
<p>This Porfolio site is coded by <a href="https://sarasjodin.com"
title="Visit sarasjodin.com's homepage" target="_blank"><b>sarasjodin.com</b></a> and is open
sourced on <a href="https://github.com/sarasjodin/OnePagePortfolio"
title="Visit this GitHub repository" target="_blank"><b>GitHub.</b></a></p>
</div>
</div>
</footer>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"
integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r"
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL"
crossorigin="anonymous"></script>
<script>
const icons = document.querySelectorAll('.icon');
icons.forEach((icon) => {
const url = icon.dataset.url;
const copyText = icon.dataset.copy;
const title = icon.querySelector('.title');
const urlElement = icon.querySelector('.url');
const message = icon.querySelector('.message');
icon.addEventListener('mouseout', () => {
urlElement.style.visibility = 'hidden';
});
icon.addEventListener('click', () => {
// Copy the hidden text to the clipboard
navigator.clipboard.writeText(copyText);
// Open the link in a new tab
window.open(url, '_blank');
});
});
function updatePaths() {
const charts = document.querySelectorAll('circle[data-percentage]');
charts.forEach(chart => {
const centerX = 100;
const centerY = 100;
const radius = 100;
const percentage = parseInt(chart.getAttribute("data-percentage"));
const startAngle = -90; // Adjusted to start from the 12 o'clock position
const endAngle = startAngle + (360 * percentage / 100);
const startRadians = (startAngle * Math.PI) / 180;
const endRadians = (endAngle * Math.PI) / 180;
const startX = centerX + radius * Math.cos(startRadians);
const startY = centerY + radius * Math.sin(startRadians);
const endX = centerX + radius * Math.cos(endRadians);
const endY = centerY + radius * Math.sin(endRadians);
const largeArcFlag = percentage > 50 ? 1 : 0; // Determine if the arc should be greater than 180 degrees
const pathCode = `M${startX},${startY} A${radius},${radius} 0 ${largeArcFlag},1 ${endX},${endY} L${centerX},${centerY} Z`;
chart.nextElementSibling.setAttribute('d', pathCode);
});
}
updatePaths();
const chartWrappers = document.querySelectorAll('.chart-wrapper');
chartWrappers.forEach((chartWrapper) => {
const circleColorElements = chartWrapper.querySelectorAll('.circle-color');
chartWrapper.addEventListener('mouseenter', function () {
circleColorElements.forEach(element => {
element.style.setProperty('fill', 'white');
});
});
chartWrapper.addEventListener('mouseleave', function () {
circleColorElements.forEach(element => {
element.style.setProperty('fill', 'whitesmoke');
});
});
});
</script>
</body>
</html>