Spaces:
Running
Running
undefined - Initial Deployment
Browse files- README.md +7 -5
- index.html +482 -19
- prompts.txt +0 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: visual-trigonometry
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,482 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Visual Trigonometry</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
| 9 |
+
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
|
| 10 |
+
<style>
|
| 11 |
+
.unit-circle {
|
| 12 |
+
width: 300px;
|
| 13 |
+
height: 300px;
|
| 14 |
+
border: 2px solid #3b82f6;
|
| 15 |
+
border-radius: 50%;
|
| 16 |
+
position: relative;
|
| 17 |
+
margin: 0 auto;
|
| 18 |
+
background-color: #f8fafc;
|
| 19 |
+
}
|
| 20 |
+
.center-point {
|
| 21 |
+
width: 6px;
|
| 22 |
+
height: 6px;
|
| 23 |
+
background-color: #ef4444;
|
| 24 |
+
border-radius: 50%;
|
| 25 |
+
position: absolute;
|
| 26 |
+
top: 50%;
|
| 27 |
+
left: 50%;
|
| 28 |
+
transform: translate(-50%, -50%);
|
| 29 |
+
}
|
| 30 |
+
.radius-line {
|
| 31 |
+
position: absolute;
|
| 32 |
+
top: 50%;
|
| 33 |
+
left: 50%;
|
| 34 |
+
height: 2px;
|
| 35 |
+
background-color: #10b981;
|
| 36 |
+
transform-origin: left center;
|
| 37 |
+
z-index: 1;
|
| 38 |
+
}
|
| 39 |
+
.triangle {
|
| 40 |
+
position: absolute;
|
| 41 |
+
border: 1px dashed #8b5cf6;
|
| 42 |
+
background-color: rgba(139, 92, 246, 0.1);
|
| 43 |
+
}
|
| 44 |
+
.angle-display {
|
| 45 |
+
position: absolute;
|
| 46 |
+
top: 10px;
|
| 47 |
+
right: 10px;
|
| 48 |
+
background-color: rgba(255, 255, 255, 0.8);
|
| 49 |
+
padding: 5px;
|
| 50 |
+
border-radius: 4px;
|
| 51 |
+
font-size: 0.8rem;
|
| 52 |
+
}
|
| 53 |
+
.highlight {
|
| 54 |
+
box-shadow: 0 0 10px 2px rgba(251, 191, 36, 0.7);
|
| 55 |
+
transition: all 0.3s ease;
|
| 56 |
+
}
|
| 57 |
+
</style>
|
| 58 |
+
</head>
|
| 59 |
+
<body class="bg-gray-50 min-h-screen">
|
| 60 |
+
<header class="bg-indigo-600 text-white py-6">
|
| 61 |
+
<div class="container mx-auto px-4">
|
| 62 |
+
<h1 class="text-3xl md:text-4xl font-bold text-center">Visual Trigonometry</h1>
|
| 63 |
+
<p class="text-center mt-2 text-indigo-100">See the relationships between angles and ratios come to life</p>
|
| 64 |
+
</div>
|
| 65 |
+
</header>
|
| 66 |
+
|
| 67 |
+
<main class="container mx-auto px-4 py-8">
|
| 68 |
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
| 69 |
+
<div class="bg-white rounded-lg shadow-lg p-6">
|
| 70 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Unit Circle Interactive</h2>
|
| 71 |
+
<div class="unit-circle" id="unitCircle">
|
| 72 |
+
<div class="center-point"></div>
|
| 73 |
+
<div class="radius-line" id="radiusLine" style="width: 120px; transform: rotate(45deg);"></div>
|
| 74 |
+
<div class="triangle" id="sineTriangle" style="width: 85px; height: 85px; left: 165px; top: 150px;"></div>
|
| 75 |
+
<div class="triangle" id="cosineTriangle" style="width: 85px; height: 85px; left: 150px; top: 165px;"></div>
|
| 76 |
+
<div class="angle-display">θ = <span id="angleValue">45</span>°</div>
|
| 77 |
+
</div>
|
| 78 |
+
<div class="mt-6 flex justify-center space-x-4">
|
| 79 |
+
<button id="increaseAngle" class="bg-indigo-600 text-white px-4 py-2 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
| 80 |
+
<i class="fas fa-plus mr-2"></i>Increase Angle
|
| 81 |
+
</button>
|
| 82 |
+
<button id="decreaseAngle" class="bg-indigo-600 text-white px-4 py-2 rounded-md hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
| 83 |
+
<i class="fas fa-minus mr-2"></i>Decrease Angle
|
| 84 |
+
</button>
|
| 85 |
+
</div>
|
| 86 |
+
<div class="mt-6 flex justify-center">
|
| 87 |
+
<input type="range" id="angleSlider" min="0" max="360" value="45" class="w-full max-w-md">
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
|
| 91 |
+
<div class="bg-white rounded-lg shadow-lg p-6">
|
| 92 |
+
<h2 class="text-2xl font-semibold text-gray-800 mb-4">Trigonometric Functions</h2>
|
| 93 |
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
|
| 94 |
+
<div class="bg-indigo-50 p-4 rounded-lg cursor-pointer" id="sinBtn">
|
| 95 |
+
<h3 class="font-medium text-indigo-700">Sine (sin)</h3>
|
| 96 |
+
<p class="text-indigo-600">Opposite / Hypotenuse</p>
|
| 97 |
+
<p class="mt-2 text-xl font-bold">sin(θ) = <span id="sinValue">0.707</span></p>
|
| 98 |
+
</div>
|
| 99 |
+
<div class="bg-green-50 p-4 rounded-lg cursor-pointer" id="cosBtn">
|
| 100 |
+
<h3 class="font-medium text-green-700">Cosine (cos)</h3>
|
| 101 |
+
<p class="text-green-600">Adjacent / Hypotenuse</p>
|
| 102 |
+
<p class="mt-2 text-xl font-bold">cos(θ) = <span id="cosValue">0.707</span></p>
|
| 103 |
+
</div>
|
| 104 |
+
<div class="bg-purple-50 p-4 rounded-lg cursor-pointer" id="tanBtn">
|
| 105 |
+
<h3 class="font-medium text-purple-700">Tangent (tan)</h3>
|
| 106 |
+
<p class="text-purple-600">Opposite / Adjacent</p>
|
| 107 |
+
<p class="mt-2 text-xl font-bold">tan(θ) = <span id="tanValue">1.000</span></p>
|
| 108 |
+
</div>
|
| 109 |
+
</div>
|
| 110 |
+
<div class="bg-gray-100 p-4 rounded-lg">
|
| 111 |
+
<canvas id="trigChart" height="200"></canvas>
|
| 112 |
+
</div>
|
| 113 |
+
</div>
|
| 114 |
+
</div>
|
| 115 |
+
|
| 116 |
+
<div class="mt-8 grid grid-cols-1 md:grid-cols-3 gap-6">
|
| 117 |
+
<div class="bg-white rounded-lg shadow-lg p-6">
|
| 118 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Right Triangle</h2>
|
| 119 |
+
<div class="relative h-40 w-full bg-blue-50 flex items-center justify-center">
|
| 120 |
+
<div class="triangle-shape" style="width: 100px; height: 100px; border-right: 2px solid #3b82f6; border-bottom: 2px solid #ef4444;"></div>
|
| 121 |
+
<div class="absolute top-0 left-0 bg-blue-100 text-blue-800 px-2 py-1 text-xs rounded" style="top: 10px; left: 60px;">Hypotenuse</div>
|
| 122 |
+
<div class="absolute bottom-0 left-0 bg-red-100 text-red-800 px-2 py-1 text-xs rounded" style="bottom: 30px; left: 10px;">Opposite</div>
|
| 123 |
+
<div class="absolute bottom-0 right-0 bg-green-100 text-green-800 px-2 py-1 text-xs rounded" style="bottom: 10px; right: 30px;">Adjacent</div>
|
| 124 |
+
<div class="absolute bottom-0 left-0 text-xs" style="bottom: 10px; left: 40px;">θ</div>
|
| 125 |
+
</div>
|
| 126 |
+
<p class="mt-4 text-gray-600">In a right-angled triangle, trigonometric functions relate the angles to the ratios of sides.</p>
|
| 127 |
+
</div>
|
| 128 |
+
|
| 129 |
+
<div class="bg-white rounded-lg shadow-lg p-6">
|
| 130 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Special Angles</h2>
|
| 131 |
+
<table class="w-full border-collapse">
|
| 132 |
+
<thead>
|
| 133 |
+
<tr class="bg-gray-100">
|
| 134 |
+
<th class="p-2 text-left">Angle</th>
|
| 135 |
+
<th class="p-2">sin</th>
|
| 136 |
+
<th class="p-2">cos</th>
|
| 137 |
+
<th class="p-2">tan</th>
|
| 138 |
+
</tr>
|
| 139 |
+
</thead>
|
| 140 |
+
<tbody>
|
| 141 |
+
<tr class="border-b border-gray-200">
|
| 142 |
+
<td class="p-2">0°</td>
|
| 143 |
+
<td class="p-2 text-center">0</td>
|
| 144 |
+
<td class="p-2 text-center">1</td>
|
| 145 |
+
<td class="p-2 text-center">0</td>
|
| 146 |
+
</tr>
|
| 147 |
+
<tr class="border-b border-gray-200">
|
| 148 |
+
<td class="p-2">30°</td>
|
| 149 |
+
<td class="p-2 text-center">1/2</td>
|
| 150 |
+
<td class="p-2 text-center">√3/2</td>
|
| 151 |
+
<td class="p-2 text-center">√3/3</td>
|
| 152 |
+
</tr>
|
| 153 |
+
<tr class="border-b border-gray-200">
|
| 154 |
+
<td class="p-2">45°</td>
|
| 155 |
+
<td class="p-2 text-center">√2/2</td>
|
| 156 |
+
<td class="p-2 text-center">√2/2</td>
|
| 157 |
+
<td class="p-2 text-center">1</td>
|
| 158 |
+
</tr>
|
| 159 |
+
<tr>
|
| 160 |
+
<td class="p-2">60°</td>
|
| 161 |
+
<td class="p-2 text-center">√3/2</td>
|
| 162 |
+
<td class="p-2 text-center">1/2</td>
|
| 163 |
+
<td class="p-2 text-center">√3</td>
|
| 164 |
+
</tr>
|
| 165 |
+
</tbody>
|
| 166 |
+
</table>
|
| 167 |
+
</div>
|
| 168 |
+
|
| 169 |
+
<div class="bg-white rounded-lg shadow-lg p-6">
|
| 170 |
+
<h2 class="text-xl font-semibold text-gray-800 mb-4">Real World Applications</h2>
|
| 171 |
+
<ul class="space-y-3">
|
| 172 |
+
<li class="flex items-start">
|
| 173 |
+
<span class="text-yellow-500 mr-2">🏗️</span>
|
| 174 |
+
<span>Architecture & Construction (calculating heights and distances)</span>
|
| 175 |
+
</li>
|
| 176 |
+
<li class="flex items-start">
|
| 177 |
+
<span class="text-blue-500 mr-2">🌊</span>
|
| 178 |
+
<span>Navigation & GPS (determining position)</span>
|
| 179 |
+
</li>
|
| 180 |
+
<li class="flex items-start">
|
| 181 |
+
<span class="text-green-500 mr-2">📡</span>
|
| 182 |
+
<span>Physics & Engineering (wave patterns, forces)</span>
|
| 183 |
+
</li>
|
| 184 |
+
<li class="flex items-start">
|
| 185 |
+
<span class="text-purple-500 mr-2">🎨</span>
|
| 186 |
+
<span>Art & Animation (rotations and perspectives)</span>
|
| 187 |
+
</li>
|
| 188 |
+
</ul>
|
| 189 |
+
</div>
|
| 190 |
+
</div>
|
| 191 |
+
</main>
|
| 192 |
+
|
| 193 |
+
<footer class="bg-gray-800 text-white py-6 mt-8">
|
| 194 |
+
<div class="container mx-auto px-4 text-center">
|
| 195 |
+
<p>© 2023 Visual Trigonometry - Helping visual learners master trigonometry</p>
|
| 196 |
+
</div>
|
| 197 |
+
</footer>
|
| 198 |
+
|
| 199 |
+
<script>
|
| 200 |
+
// Initialize variables
|
| 201 |
+
let currentAngle = 45;
|
| 202 |
+
let trigChart;
|
| 203 |
+
|
| 204 |
+
// DOM elements
|
| 205 |
+
const unitCircle = document.getElementById('unitCircle');
|
| 206 |
+
const radiusLine = document.getElementById('radiusLine');
|
| 207 |
+
const sineTriangle = document.getElementById('sineTriangle');
|
| 208 |
+
const cosineTriangle = document.getElementById('cosineTriangle');
|
| 209 |
+
const angleValue = document.getElementById('angleValue');
|
| 210 |
+
const angleSlider = document.getElementById('angleSlider');
|
| 211 |
+
const increaseAngle = document.getElementById('increaseAngle');
|
| 212 |
+
const decreaseAngle = document.getElementById('decreaseAngle');
|
| 213 |
+
const sinValue = document.getElementById('sinValue');
|
| 214 |
+
const cosValue = document.getElementById('cosValue');
|
| 215 |
+
const tanValue = document.getElementById('tanValue');
|
| 216 |
+
const sinBtn = document.getElementById('sinBtn');
|
| 217 |
+
const cosBtn = document.getElementById('cosBtn');
|
| 218 |
+
const tanBtn = document.getElementById('tanBtn');
|
| 219 |
+
|
| 220 |
+
// Initialize chart
|
| 221 |
+
function initializeChart() {
|
| 222 |
+
const ctx = document.getElementById('trigChart').getContext('2d');
|
| 223 |
+
trigChart = new Chart(ctx, {
|
| 224 |
+
type: 'line',
|
| 225 |
+
data: {
|
| 226 |
+
labels: Array.from({length: 181}, (_, i) => i), // 0 to 180 degrees
|
| 227 |
+
datasets: [
|
| 228 |
+
{
|
| 229 |
+
label: 'Sine',
|
| 230 |
+
data: [],
|
| 231 |
+
borderColor: '#3b82f6',
|
| 232 |
+
backgroundColor: 'rgba(59, 130, 246, 0.1)',
|
| 233 |
+
tension: 0.4,
|
| 234 |
+
pointRadius: 0
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
label: 'Cosine',
|
| 238 |
+
data: [],
|
| 239 |
+
borderColor: '#10b981',
|
| 240 |
+
backgroundColor: 'rgba(16, 185, 129, 0.1)',
|
| 241 |
+
tension: 0.4,
|
| 242 |
+
pointRadius: 0
|
| 243 |
+
},
|
| 244 |
+
{
|
| 245 |
+
label: 'Tangent',
|
| 246 |
+
data: [],
|
| 247 |
+
borderColor: '#8b5cf6',
|
| 248 |
+
backgroundColor: 'rgba(139, 92, 246, 0.1)',
|
| 249 |
+
tension: 0.4,
|
| 250 |
+
pointRadius: 0,
|
| 251 |
+
borderDash: [5, 5]
|
| 252 |
+
}
|
| 253 |
+
]
|
| 254 |
+
},
|
| 255 |
+
options: {
|
| 256 |
+
responsive: true,
|
| 257 |
+
plugins: {
|
| 258 |
+
legend: {
|
| 259 |
+
position: 'top'
|
| 260 |
+
},
|
| 261 |
+
tooltip: {
|
| 262 |
+
callbacks: {
|
| 263 |
+
label: function(context) {
|
| 264 |
+
return context.dataset.label + ': ' + context.raw.toFixed(3);
|
| 265 |
+
}
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
},
|
| 269 |
+
scales: {
|
| 270 |
+
x: {
|
| 271 |
+
title: {
|
| 272 |
+
display: true,
|
| 273 |
+
text: 'Angle (degrees)'
|
| 274 |
+
}
|
| 275 |
+
},
|
| 276 |
+
y: {
|
| 277 |
+
title: {
|
| 278 |
+
display: true,
|
| 279 |
+
text: 'Value'
|
| 280 |
+
},
|
| 281 |
+
min: -1.2,
|
| 282 |
+
max: 1.2
|
| 283 |
+
}
|
| 284 |
+
}
|
| 285 |
+
}
|
| 286 |
+
});
|
| 287 |
+
|
| 288 |
+
// Pre-calculate data for the chart
|
| 289 |
+
const sineData = [];
|
| 290 |
+
const cosineData = [];
|
| 291 |
+
const tangentData = [];
|
| 292 |
+
|
| 293 |
+
for (let i = 0; i <= 180; i++) {
|
| 294 |
+
const radians = i * Math.PI / 180;
|
| 295 |
+
sineData.push(Math.sin(radians));
|
| 296 |
+
cosineData.push(Math.cos(radians));
|
| 297 |
+
tangentData.push(Math.tan(radians));
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
trigChart.data.datasets[0].data = sineData;
|
| 301 |
+
trigChart.data.datasets[1].data = cosineData;
|
| 302 |
+
trigChart.data.datasets[2].data = tangentData;
|
| 303 |
+
trigChart.update();
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
// Update unit circle visualization
|
| 307 |
+
function updateUnitCircle(angle) {
|
| 308 |
+
const radians = angle * Math.PI / 180;
|
| 309 |
+
const radius = 120;
|
| 310 |
+
const centerX = 150;
|
| 311 |
+
const centerY = 150;
|
| 312 |
+
|
| 313 |
+
// Update radius line
|
| 314 |
+
radiusLine.style.transform = `rotate(${angle}deg)`;
|
| 315 |
+
|
| 316 |
+
// Calculate endpoints
|
| 317 |
+
const endX = centerX + radius * Math.cos(radians);
|
| 318 |
+
const endY = centerY - radius * Math.sin(radians);
|
| 319 |
+
|
| 320 |
+
// Position triangles
|
| 321 |
+
const sinHeight = Math.abs(radius * Math.sin(radians));
|
| 322 |
+
const cosWidth = Math.abs(radius * Math.cos(radians));
|
| 323 |
+
|
| 324 |
+
if (angle < 180) {
|
| 325 |
+
sineTriangle.style.left = `${centerX}px`;
|
| 326 |
+
sineTriangle.style.top = `${centerY - sinHeight}px`;
|
| 327 |
+
sineTriangle.style.width = `${cosWidth}px`;
|
| 328 |
+
sineTriangle.style.height = `${sinHeight}px`;
|
| 329 |
+
sineTriangle.style.borderRight = '1px dashed #8b5cf6';
|
| 330 |
+
} else {
|
| 331 |
+
sineTriangle.style.left = `${centerX + cosWidth}px`;
|
| 332 |
+
sineTriangle.style.top = `${centerY}px`;
|
| 333 |
+
sineTriangle.style.width = `${Math.abs(radius * Math.cos(radians + Math.PI))}px`;
|
| 334 |
+
sineTriangle.style.height = `${sinHeight}px`;
|
| 335 |
+
sineTriangle.style.borderLeft = '1px dashed #8b5cf6';
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
if (angle < 90 || angle > 270) {
|
| 339 |
+
cosineTriangle.style.left = `${centerX}px`;
|
| 340 |
+
cosineTriangle.style.top = `${centerY}px`;
|
| 341 |
+
cosineTriangle.style.width = `${cosWidth}px`;
|
| 342 |
+
cosineTriangle.style.height = `${sinHeight}px`;
|
| 343 |
+
cosineTriangle.style.borderBottom = '1px dashed #8b5cf6';
|
| 344 |
+
} else {
|
| 345 |
+
cosineTriangle.style.left = `${centerX}px`;
|
| 346 |
+
cosineTriangle.style.top = `${centerY - sinHeight}px`;
|
| 347 |
+
cosineTriangle.style.width = `${cosWidth}px`;
|
| 348 |
+
cosineTriangle.style.height = `${sinHeight}px`;
|
| 349 |
+
cosineTriangle.style.borderTop = '1px dashed #8b5cf6';
|
| 350 |
+
}
|
| 351 |
+
|
| 352 |
+
// Update displayed values
|
| 353 |
+
angleValue.textContent = angle;
|
| 354 |
+
sinValue.textContent = Math.sin(radians).toFixed(3);
|
| 355 |
+
cosValue.textContent = Math.cos(radians).toFixed(3);
|
| 356 |
+
|
| 357 |
+
const tanVal = Math.tan(radians);
|
| 358 |
+
if (Math.abs(tanVal) > 10) {
|
| 359 |
+
tanValue.textContent = tanVal > 0 ? "∞" : "-∞";
|
| 360 |
+
} else {
|
| 361 |
+
tanValue.textContent = tanVal.toFixed(3);
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
// Highlight current position on chart
|
| 365 |
+
trigChart.options.scales.x.afterDraw = function(chart) {
|
| 366 |
+
const ctx = chart.ctx;
|
| 367 |
+
const xAxis = chart.scales.x;
|
| 368 |
+
const yAxis = chart.scales.y;
|
| 369 |
+
const xPos = xAxis.getPixelForValue(angle);
|
| 370 |
+
|
| 371 |
+
ctx.save();
|
| 372 |
+
ctx.beginPath();
|
| 373 |
+
ctx.moveTo(xPos, yAxis.top);
|
| 374 |
+
ctx.lineTo(xPos, yAxis.bottom);
|
| 375 |
+
ctx.strokeStyle = 'rgba(0, 0, 0, 0.1)';
|
| 376 |
+
ctx.lineWidth = 1;
|
| 377 |
+
ctx.stroke();
|
| 378 |
+
|
| 379 |
+
// Highlight point on sine curve
|
| 380 |
+
const sinPoint = yAxis.getPixelForValue(Math.sin(radians));
|
| 381 |
+
ctx.beginPath();
|
| 382 |
+
ctx.arc(xPos, sinPoint, 4, 0, 2 * Math.PI);
|
| 383 |
+
ctx.fillStyle = '#3b82f6';
|
| 384 |
+
ctx.fill();
|
| 385 |
+
|
| 386 |
+
// Highlight point on cosine curve
|
| 387 |
+
const cosPoint = yAxis.getPixelForValue(Math.cos(radians));
|
| 388 |
+
ctx.beginPath();
|
| 389 |
+
ctx.arc(xPos, cosPoint, 4, 0, 2 * Math.PI);
|
| 390 |
+
ctx.fillStyle = '#10b981';
|
| 391 |
+
ctx.fill();
|
| 392 |
+
|
| 393 |
+
// Highlight point on tangent curve (if visible)
|
| 394 |
+
if (Math.abs(tanVal) <= 2) {
|
| 395 |
+
const tanPoint = yAxis.getPixelForValue(tanVal);
|
| 396 |
+
ctx.beginPath();
|
| 397 |
+
ctx.arc(xPos, tanPoint, 4, 0, 2 * Math.PI);
|
| 398 |
+
ctx.fillStyle = '#8b5cf6';
|
| 399 |
+
ctx.fill();
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
ctx.restore();
|
| 403 |
+
};
|
| 404 |
+
|
| 405 |
+
trigChart.update();
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
// Event listeners
|
| 409 |
+
increaseAngle.addEventListener('click', function() {
|
| 410 |
+
currentAngle = (currentAngle + 5) % 360;
|
| 411 |
+
angleSlider.value = currentAngle;
|
| 412 |
+
updateUnitCircle(currentAngle);
|
| 413 |
+
});
|
| 414 |
+
|
| 415 |
+
decreaseAngle.addEventListener('click', function() {
|
| 416 |
+
currentAngle = (currentAngle - 5 + 360) % 360;
|
| 417 |
+
angleSlider.value = currentAngle;
|
| 418 |
+
updateUnitCircle(currentAngle);
|
| 419 |
+
});
|
| 420 |
+
|
| 421 |
+
angleSlider.addEventListener('input', function() {
|
| 422 |
+
currentAngle = parseInt(this.value);
|
| 423 |
+
updateUnitCircle(currentAngle);
|
| 424 |
+
});
|
| 425 |
+
|
| 426 |
+
// Highlight function explanations
|
| 427 |
+
sinBtn.addEventListener('click', function() {
|
| 428 |
+
this.classList.add('highlight');
|
| 429 |
+
setTimeout(() => this.classList.remove('highlight'), 1000);
|
| 430 |
+
|
| 431 |
+
// Add visual explanation for sine
|
| 432 |
+
const oldLeft = cosineTriangle.style.left;
|
| 433 |
+
const oldTop = cosineTriangle.style.top;
|
| 434 |
+
|
| 435 |
+
if (currentAngle > 180) {
|
| 436 |
+
sineTriangle.style.left = `${150 - 120 * Math.abs(Math.cos(currentAngle * Math.PI / 180))}px`;
|
| 437 |
+
}
|
| 438 |
+
sineTriangle.style.top = `${150 - 120 * Math.sin(currentAngle * Math.PI / 180)}px`;
|
| 439 |
+
|
| 440 |
+
setTimeout(() => {
|
| 441 |
+
sineTriangle.style.left = oldLeft;
|
| 442 |
+
sineTriangle.style.top = oldTop;
|
| 443 |
+
}, 1000);
|
| 444 |
+
});
|
| 445 |
+
|
| 446 |
+
cosBtn.addEventListener('click', function() {
|
| 447 |
+
this.classList.add('highlight');
|
| 448 |
+
setTimeout(() => this.classList.remove('highlight'), 1000);
|
| 449 |
+
|
| 450 |
+
// Add visual explanation for cosine
|
| 451 |
+
const oldLeft = cosineTriangle.style.left;
|
| 452 |
+
const oldTop = cosineTriangle.style.top;
|
| 453 |
+
|
| 454 |
+
cosineTriangle.style.left = `${150 + 120 * Math.cos(currentAngle * Math.PI / 180)}px`;
|
| 455 |
+
cosineTriangle.style.top = `${150 - 120 * Math.sin(currentAngle * Math.PI / 180)}px`;
|
| 456 |
+
|
| 457 |
+
setTimeout(() => {
|
| 458 |
+
cosineTriangle.style.left = oldLeft;
|
| 459 |
+
cosineTriangle.style.top = oldTop;
|
| 460 |
+
}, 1000);
|
| 461 |
+
});
|
| 462 |
+
|
| 463 |
+
tanBtn.addEventListener('click', function() {
|
| 464 |
+
this.classList.add('highlight');
|
| 465 |
+
setTimeout(() => this.classList.remove('highlight'), 1000);
|
| 466 |
+
|
| 467 |
+
// Add visual explanation for tangent
|
| 468 |
+
const oldBorder = sineTriangle.style.borderBottom;
|
| 469 |
+
sineTriangle.style.borderBottom = '2px solid #8b5cf6';
|
| 470 |
+
setTimeout(() => {
|
| 471 |
+
sineTriangle.style.borderBottom = oldBorder;
|
| 472 |
+
}, 1000);
|
| 473 |
+
});
|
| 474 |
+
|
| 475 |
+
// Initialize
|
| 476 |
+
document.addEventListener('DOMContentLoaded', function() {
|
| 477 |
+
initializeChart();
|
| 478 |
+
updateUnitCircle(currentAngle);
|
| 479 |
+
});
|
| 480 |
+
</script>
|
| 481 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=onlyoneritz/visual-trigonometry" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 482 |
+
</html>
|
prompts.txt
ADDED
|
File without changes
|