-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIndex.html
More file actions
212 lines (187 loc) · 7.24 KB
/
Index.html
File metadata and controls
212 lines (187 loc) · 7.24 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>⚡ Advanced Array Logic Dashboard</title>
<style>
/* CSS RESET & GENERAL STYLES */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Poppins', sans-serif;
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 400% 400%;
animation: gradientBG 15s ease infinite; /* Cool Animated Background */
color: #333;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
padding: 20px;
}
/* BACKGROUND ANIMATION */
@keyframes gradientBG {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
/* CONTAINER STYLING */
.dashboard-container {
max-width: 900px;
width: 100%;
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
padding: 30px;
border-radius: 20px;
box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
h1 { text-align: center; color: #1a1a1a; margin-bottom: 20px; }
/* CARD STYLING & ANIMATION */
.card {
background: white;
padding: 20px;
margin: 15px 0;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease; /* Smooth hover effect */
opacity: 0;
animation: fadeInCard 0.5s ease forwards; /* Animated entrance */
}
/* Entrance Animation for Cards */
@keyframes fadeInCard {
from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); }
}
.card:hover {
transform: translateY(-5px); /* Gentle lift on hover */
box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}
.card:nth-child(2) { animation-delay: 0.1s; }
.card:nth-child(3) { animation-delay: 0.2s; }
.card:nth-child(4) { animation-delay: 0.3s; }
.card:nth-child(5) { animation-delay: 0.4s; }
.card:nth-child(6) { animation-delay: 0.5s; }
/* INPUT & BUTTON STYLING */
input {
padding: 10px;
border: 2px solid #ddd;
border-radius: 8px;
width: 100%;
max-width: 250px;
margin-right: 10px;
margin-bottom: 10px;
transition: border-color 0.3s ease;
}
input:focus { outline: none; border-color: #23a6d5; }
button {
padding: 10px 20px;
background: #4a90e2;
color: white;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background 0.3s ease, transform 0.1s ease;
position: relative;
overflow: hidden;
}
button:hover { background: #357abd; }
button:active { transform: scale(0.95); } /* Button press effect */
/* Ripple Effect for Button (Advanced CSS) */
button::after {
content: '';
position: absolute;
background: rgba(255, 255, 255, 0.3);
width: 100px; height: 100px;
border-radius: 50%;
left: 50%; top: 50%;
transform: translate(-50%, -50%) scale(0);
transition: transform 0.5s ease-out;
}
button:focus::after { transform: translate(-50%, -50%) scale(2); opacity: 0; }
/* RESULT STYLING */
.result {
margin-top: 15px;
font-weight: bold;
color: #2c3e50;
padding: 10px;
border-left: 4px solid transparent;
opacity: 0;
transition: opacity 0.5s ease, border-color 0.5s ease;
}
.result.show { opacity: 1; border-color: #27ae60; background-color: #f9f9f9; }
</style>
</head>
<body>
<div class="dashboard-container">
<h1>📊 Array Logic Dashboard ⚡</h1>
<div class="card">
<h3>1. Student Scores (Average)</h3>
<input type="text" id="p1" placeholder="5 scores (e.g. 80 90 85 95 88)" aria-label="Enter five student scores">
<button onclick="solveP1()">Compute</button>
<div id="res1" class="result"></div>
</div>
<div class="card">
<h3>2. Array Sum & Display</h3>
<button onclick="solveP2()">Show Sum of [10, 20, 30, 40, 50]</button>
<div id="res2" class="result"></div>
</div>
<div class="card">
<h3>3. Even Counter</h3>
<input type="text" id="p3" placeholder="5 numbers (e.g. 1 2 3 4 5)" aria-label="Enter five numbers">
<button onclick="solveP3()">Count Evens</button>
<div id="res3" class="result"></div>
</div>
<div class="card">
<h3>4. Find Largest</h3>
<button onclick="solveP4()">Find Max of [5, 12, 7, 20, 3]</button>
<div id="res4" class="result"></div>
</div>
<div class="card">
<h3>5. Search Number</h3>
<input type="number" id="p5" placeholder="Number to search" aria-label="Enter a number to search">
<button onclick="solveP5()">Search</button>
<div id="res5" class="result"></div>
</div>
</div>
<script>
function showResult(elementId, text) {
let el = document.getElementById(elementId);
el.innerText = text;
el.classList.add('show');
}
function solveP1() {
let inputVal = document.getElementById('p1').value;
if(!inputVal) return;
let arr = inputVal.split(' ').filter(x => x !== "").map(Number);
if(arr.length < 1) return;
let sum = arr.reduce((a,b) => a+b, 0);
let avg = sum / arr.length;
showResult('res1', `🔢 Array: [${arr.join(', ')}] | 📊 Average: ${avg.toFixed(2)}`);
}
function solveP2() {
let arr = [10, 20, 30, 40, 50];
let sum = arr.reduce((a,b) => a+b, 0);
showResult('res2', `Numbers: ${arr.join(', ')} | 🟰 Total Sum: ${sum}`);
}
function solveP3() {
let inputVal = document.getElementById('p3').value;
if(!inputVal) return;
let arr = inputVal.split(' ').filter(x => x !== "").map(Number);
if(arr.length < 1) return;
let count = arr.filter(n => n % 2 === 0).length;
showResult('res3', `🔢 Array: [${arr.join(', ')}] | 🎯 Even Count: ${count}`);
}
function solveP4() {
let arr = [5, 12, 7, 20, 3];
showResult('res4', `Numbers: ${arr.join(', ')} | 🏆 Largest: ${Math.max(...arr)}`);
}
function solveP5() {
let arr = [2, 4, 6, 8, 10];
let targetStr = document.getElementById('p5').value;
if(targetStr === "") return;
let target = parseInt(targetStr);
let exists = arr.includes(target);
showResult('res5', `Search for ${target} in [${arr.join(', ')}]: ${exists ? "✅ Found!" : "❌ Not Found."}`);
}
</script>
</body>
</html>