Add 1 files
Browse files- index.html +364 -499
index.html
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
| 9 |
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.min.js"></script>
|
|
@@ -24,129 +24,71 @@
|
|
| 24 |
width: 90%;
|
| 25 |
max-width: 600px;
|
| 26 |
}
|
| 27 |
-
.
|
| 28 |
transition: all 0.3s ease;
|
| 29 |
filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
|
| 30 |
}
|
| 31 |
-
.
|
| 32 |
transform: translateY(-5px) scale(1.05);
|
| 33 |
}
|
| 34 |
-
.active-
|
| 35 |
transform: scale(1.1);
|
| 36 |
box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
|
| 37 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
</style>
|
| 39 |
</head>
|
| 40 |
<body>
|
| 41 |
<div id="math-container"></div>
|
| 42 |
|
| 43 |
<div class="control-panel bg-white bg-opacity-90 p-4 rounded-xl shadow-xl">
|
| 44 |
-
<div class="grid grid-cols-
|
| 45 |
-
<!-- Nombres -->
|
| 46 |
-
<button onclick="loadConcept('numbers')" class="concept-btn bg-blue-50 p-3 rounded-lg flex items-center justify-center">
|
| 47 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 48 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
|
| 49 |
-
</svg>
|
| 50 |
-
</button>
|
| 51 |
-
|
| 52 |
<!-- Addition -->
|
| 53 |
-
<button onclick="
|
| 54 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 55 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
|
| 56 |
</svg>
|
| 57 |
</button>
|
| 58 |
|
| 59 |
<!-- Soustraction -->
|
| 60 |
-
<button onclick="
|
| 61 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-red-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 62 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H4"/>
|
| 63 |
</svg>
|
| 64 |
</button>
|
| 65 |
|
| 66 |
<!-- Multiplication -->
|
| 67 |
-
<button onclick="
|
| 68 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-yellow-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 69 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
| 70 |
</svg>
|
| 71 |
</button>
|
| 72 |
|
| 73 |
<!-- Division -->
|
| 74 |
-
<button onclick="
|
| 75 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-purple-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 76 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2"/>
|
| 77 |
</svg>
|
| 78 |
</button>
|
| 79 |
-
|
| 80 |
-
<!-- Fractions -->
|
| 81 |
-
<button onclick="loadConcept('fractions')" class="concept-btn bg-pink-50 p-3 rounded-lg flex items-center justify-center">
|
| 82 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-pink-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 83 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 10h18M3 14h18m-9-4v8m-7 0h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"/>
|
| 84 |
-
</svg>
|
| 85 |
-
</button>
|
| 86 |
-
|
| 87 |
-
<!-- Géométrie -->
|
| 88 |
-
<button onclick="loadConcept('geometry')" class="concept-btn bg-indigo-50 p-3 rounded-lg flex items-center justify-center">
|
| 89 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-indigo-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 90 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4"/>
|
| 91 |
-
</svg>
|
| 92 |
-
</button>
|
| 93 |
</div>
|
| 94 |
|
| 95 |
-
<div class="grid grid-cols-
|
| 96 |
-
<!--
|
| 97 |
-
<button onclick="loadConcept('place-value')" class="concept-btn bg-teal-50 p-3 rounded-lg flex items-center justify-center">
|
| 98 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-teal-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 99 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
|
| 100 |
-
</svg>
|
| 101 |
-
</button>
|
| 102 |
-
|
| 103 |
-
<!-- Grands nombres -->
|
| 104 |
-
<button onclick="loadConcept('large-numbers')" class="concept-btn bg-amber-50 p-3 rounded-lg flex items-center justify-center">
|
| 105 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-amber-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 106 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 011-1h14a1 1 0 011 1v14a1 1 0 01-1 1H5a1 1 0 01-1-1V5z"/>
|
| 107 |
-
</svg>
|
| 108 |
-
</button>
|
| 109 |
-
|
| 110 |
-
<!-- Pourcentages -->
|
| 111 |
-
<button onclick="loadConcept('percentages')" class="concept-btn bg-rose-50 p-3 rounded-lg flex items-center justify-center">
|
| 112 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-rose-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 113 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 17v-2m3 2v-4m3 4v-6m2 10H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
|
| 114 |
-
</svg>
|
| 115 |
-
</button>
|
| 116 |
-
|
| 117 |
-
<!-- Algèbre -->
|
| 118 |
-
<button onclick="loadConcept('algebra')" class="concept-btn bg-lime-50 p-3 rounded-lg flex items-center justify-center">
|
| 119 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-lime-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 120 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 21a4 4 0 01-4-4V5a2 2 0 012-2h4a2 2 0 012 2v12a4 4 0 01-4 4zm0 0h12a2 2 0 002-2v-4a2 2 0 00-2-2h-2.343M11 7.343l1.657-1.657a2 2 0 012.828 0l2.829 2.829a2 2 0 010 2.828l-8.486 8.485M7 17h.01"/>
|
| 121 |
-
</svg>
|
| 122 |
-
</button>
|
| 123 |
-
|
| 124 |
-
<!-- Mesures -->
|
| 125 |
-
<button onclick="loadConcept('measurement')" class="concept-btn bg-cyan-50 p-3 rounded-lg flex items-center justify-center">
|
| 126 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-cyan-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 127 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4"/>
|
| 128 |
-
</svg>
|
| 129 |
-
</button>
|
| 130 |
-
|
| 131 |
-
<!-- Statistiques -->
|
| 132 |
-
<button onclick="loadConcept('statistics')" class="concept-btn bg-violet-50 p-3 rounded-lg flex items-center justify-center">
|
| 133 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-violet-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 134 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"/>
|
| 135 |
-
</svg>
|
| 136 |
-
</button>
|
| 137 |
-
|
| 138 |
-
<!-- Probabilités -->
|
| 139 |
-
<button onclick="loadConcept('probability')" class="concept-btn bg-fuchsia-50 p-3 rounded-lg flex items-center justify-center">
|
| 140 |
-
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-fuchsia-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 141 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 8h14M5 8a2 2 0 110-4h14a2 2 0 110 4M5 8v10a2 2 0 002 2h10a2 2 0 002-2V8m-9 4h4"/>
|
| 142 |
-
</svg>
|
| 143 |
-
</button>
|
| 144 |
</div>
|
| 145 |
</div>
|
| 146 |
|
| 147 |
<script>
|
| 148 |
// Initialisation Three.js
|
| 149 |
-
let scene, camera, renderer, controls,
|
| 150 |
const objects = [];
|
| 151 |
|
| 152 |
function init() {
|
|
@@ -203,7 +145,7 @@
|
|
| 203 |
window.addEventListener('resize', onWindowResize);
|
| 204 |
|
| 205 |
// Chargement initial
|
| 206 |
-
|
| 207 |
}
|
| 208 |
|
| 209 |
function onWindowResize() {
|
|
@@ -212,69 +154,97 @@
|
|
| 212 |
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 213 |
}
|
| 214 |
|
| 215 |
-
// Fonctions de chargement des
|
| 216 |
-
function
|
| 217 |
-
|
| 218 |
clearScene();
|
| 219 |
updateActiveButton();
|
|
|
|
| 220 |
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 225 |
case 'addition':
|
| 226 |
-
|
| 227 |
break;
|
| 228 |
case 'subtraction':
|
| 229 |
-
|
| 230 |
break;
|
| 231 |
case 'multiplication':
|
| 232 |
-
|
| 233 |
break;
|
| 234 |
case 'division':
|
| 235 |
-
|
| 236 |
-
break;
|
| 237 |
-
case 'fractions':
|
| 238 |
-
demonstrateFractions();
|
| 239 |
-
break;
|
| 240 |
-
case 'geometry':
|
| 241 |
-
demonstrateGeometry();
|
| 242 |
break;
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 254 |
break;
|
| 255 |
-
case '
|
| 256 |
-
|
| 257 |
break;
|
| 258 |
-
case '
|
| 259 |
-
|
| 260 |
break;
|
| 261 |
-
case '
|
| 262 |
-
|
| 263 |
break;
|
| 264 |
}
|
| 265 |
}
|
| 266 |
|
| 267 |
function updateActiveButton() {
|
| 268 |
-
document.querySelectorAll('.
|
| 269 |
-
btn.classList.remove('active-
|
| 270 |
});
|
| 271 |
|
| 272 |
-
const activeBtn = document.querySelector(`[onclick="
|
| 273 |
if (activeBtn) {
|
| 274 |
-
activeBtn.classList.add('active-
|
| 275 |
}
|
| 276 |
}
|
| 277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
function clearScene() {
|
| 279 |
// Supprimer tous les objets sauf les lumières et helpers
|
| 280 |
const toRemove = [];
|
|
@@ -288,384 +258,218 @@
|
|
| 288 |
objects.length = 0;
|
| 289 |
}
|
| 290 |
|
| 291 |
-
// Fonctions de démonstration des
|
| 292 |
-
function
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
| 310 |
-
|
| 311 |
-
|
| 312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
}
|
| 314 |
}
|
| 315 |
|
| 316 |
-
function
|
| 317 |
-
|
| 318 |
-
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
|
| 340 |
-
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
const group3 = createSphereGroup(4, -3, 2, 0x3b82f6);
|
| 357 |
-
|
| 358 |
-
// Animation pour montrer la multiplication
|
| 359 |
-
setTimeout(() => {
|
| 360 |
-
animateGroup(group1, { x: 0, z: -2 }, 800);
|
| 361 |
-
animateGroup(group2, { x: 0, z: 0 }, 800);
|
| 362 |
-
animateGroup(group3, { x: 0, z: 2 }, 800, () => {
|
| 363 |
-
const resultGroup = createSphereGroup(12, 3, 0, 0x10b981);
|
| 364 |
-
animateGroup(resultGroup, { y: 2 }, 800);
|
| 365 |
-
});
|
| 366 |
-
}, 1000);
|
| 367 |
-
}
|
| 368 |
-
|
| 369 |
-
function demonstrateDivision() {
|
| 370 |
-
createMathBase();
|
| 371 |
-
|
| 372 |
-
// Groupe initial
|
| 373 |
-
const initialGroup = createSphereGroup(12, 0, 0, 0x3b82f6);
|
| 374 |
-
|
| 375 |
-
// Animation de la division
|
| 376 |
-
setTimeout(() => {
|
| 377 |
-
const group1 = createSphereGroup(4, -3, -2, 0xef4444);
|
| 378 |
-
const group2 = createSphereGroup(4, -3, 0, 0xef4444);
|
| 379 |
-
const group3 = createSphereGroup(4, -3, 2, 0xef4444);
|
| 380 |
-
|
| 381 |
-
setTimeout(() => {
|
| 382 |
-
animateGroup(group1, { x: -3, z: -2 }, 800);
|
| 383 |
-
animateGroup(group2, { x: -3, z: 0 }, 800);
|
| 384 |
-
animateGroup(group3, { x: -3, z: 2 }, 800);
|
| 385 |
-
}, 1000);
|
| 386 |
-
}, 1000);
|
| 387 |
-
}
|
| 388 |
-
|
| 389 |
-
function demonstrateFractions() {
|
| 390 |
-
createMathBase();
|
| 391 |
-
|
| 392 |
-
// Création d'un cercle fractionné
|
| 393 |
-
const circleGeometry = new THREE.CircleGeometry(3, 32);
|
| 394 |
-
|
| 395 |
-
// Demi-cercle (1/2)
|
| 396 |
-
const halfCircle1 = new THREE.Mesh(
|
| 397 |
-
new THREE.ShapeGeometry(new THREE.Shape(circleGeometry.attributes.position.array.slice(0, 97))),
|
| 398 |
-
new THREE.MeshPhongMaterial({ color: 0x3b82f6, side: THREE.DoubleSide })
|
| 399 |
-
);
|
| 400 |
-
halfCircle1.position.set(-4, 0, 0);
|
| 401 |
-
scene.add(halfCircle1);
|
| 402 |
-
objects.push(halfCircle1);
|
| 403 |
-
|
| 404 |
-
const halfCircle2 = new THREE.Mesh(
|
| 405 |
-
new THREE.ShapeGeometry(new THREE.Shape(circleGeometry.attributes.position.array.slice(96))),
|
| 406 |
-
new THREE.MeshPhongMaterial({ color: 0xef4444, side: THREE.DoubleSide })
|
| 407 |
-
);
|
| 408 |
-
halfCircle2.position.set(-4, 0, 0);
|
| 409 |
-
scene.add(halfCircle2);
|
| 410 |
-
objects.push(halfCircle2);
|
| 411 |
-
|
| 412 |
-
// Quart de cercle (1/4)
|
| 413 |
-
const quarterCircle = new THREE.Mesh(
|
| 414 |
-
new THREE.ShapeGeometry(new THREE.Shape(circleGeometry.attributes.position.array.slice(0, 49))),
|
| 415 |
-
new THREE.MeshPhongMaterial({ color: 0x10b981, side: THREE.DoubleSide })
|
| 416 |
-
);
|
| 417 |
-
quarterCircle.position.set(4, 0, 0);
|
| 418 |
-
scene.add(quarterCircle);
|
| 419 |
-
objects.push(quarterCircle);
|
| 420 |
-
|
| 421 |
-
// Animation
|
| 422 |
-
setTimeout(() => {
|
| 423 |
-
animateObject(halfCircle1, { rotation: { z: Math.PI } }, 1000);
|
| 424 |
-
animateObject(halfCircle2, { rotation: { z: Math.PI } }, 1000);
|
| 425 |
-
animateObject(quarterCircle, { rotation: { z: Math.PI * 2 } }, 1500);
|
| 426 |
-
}, 1000);
|
| 427 |
-
}
|
| 428 |
-
|
| 429 |
-
function demonstrateGeometry() {
|
| 430 |
-
createMathBase();
|
| 431 |
-
|
| 432 |
-
// Cube
|
| 433 |
-
const cubeGeometry = new THREE.BoxGeometry(2, 2, 2);
|
| 434 |
-
const cubeMaterial = new THREE.MeshPhongMaterial({ color: 0x3b82f6, wireframe: false });
|
| 435 |
-
const cube = new THREE.Mesh(cubeGeometry, cubeMaterial);
|
| 436 |
-
cube.position.set(-4, 1, 0);
|
| 437 |
-
cube.castShadow = true;
|
| 438 |
-
cube.userData.animate = true;
|
| 439 |
-
scene.add(cube);
|
| 440 |
-
objects.push(cube);
|
| 441 |
-
|
| 442 |
-
// Sphère
|
| 443 |
-
const sphereGeometry = new THREE.SphereGeometry(1, 32, 32);
|
| 444 |
-
const sphereMaterial = new THREE.MeshPhongMaterial({ color: 0xef4444, wireframe: false });
|
| 445 |
-
const sphere = new THREE.Mesh(sphereGeometry, sphereMaterial);
|
| 446 |
-
sphere.position.set(0, 1, 0);
|
| 447 |
-
sphere.castShadow = true;
|
| 448 |
-
sphere.userData.animate = true;
|
| 449 |
-
scene.add(sphere);
|
| 450 |
-
objects.push(sphere);
|
| 451 |
-
|
| 452 |
-
// Cylindre
|
| 453 |
-
const cylinderGeometry = new THREE.CylinderGeometry(1, 1, 2, 32);
|
| 454 |
-
const cylinderMaterial = new THREE.MeshPhongMaterial({ color: 0x10b981, wireframe: false });
|
| 455 |
-
const cylinder = new THREE.Mesh(cylinderGeometry, cylinderMaterial);
|
| 456 |
-
cylinder.position.set(4, 1, 0);
|
| 457 |
-
cylinder.castShadow = true;
|
| 458 |
-
cylinder.userData.animate = true;
|
| 459 |
-
scene.add(cylinder);
|
| 460 |
-
objects.push(cylinder);
|
| 461 |
-
|
| 462 |
-
// Animation pour montrer les faces
|
| 463 |
-
setTimeout(() => {
|
| 464 |
-
cubeMaterial.wireframe = true;
|
| 465 |
-
sphereMaterial.wireframe = true;
|
| 466 |
-
cylinderMaterial.wireframe = true;
|
| 467 |
-
}, 1500);
|
| 468 |
-
}
|
| 469 |
-
|
| 470 |
-
function demonstratePlaceValue() {
|
| 471 |
-
createMathBase();
|
| 472 |
-
|
| 473 |
-
// Création d'un nombre à 3 chiffres
|
| 474 |
-
const hundreds = createPlaceValueBlock(1, -4, 0, 0x3b82f6, 10);
|
| 475 |
-
const tens = createPlaceValueBlock(2, 0, 0, 0x10b981, 5);
|
| 476 |
-
const units = createPlaceValueBlock(3, 4, 0, 0xef4444, 1);
|
| 477 |
-
|
| 478 |
-
// Animation pour montrer la décomposition
|
| 479 |
-
setTimeout(() => {
|
| 480 |
-
animateGroup(hundreds, { y: 2 }, 800);
|
| 481 |
-
animateGroup(tens, { y: 2 }, 800);
|
| 482 |
-
animateGroup(units, { y: 2 }, 800);
|
| 483 |
-
}, 1000);
|
| 484 |
-
}
|
| 485 |
-
|
| 486 |
-
function demonstrateLargeNumbers() {
|
| 487 |
-
createMathBase();
|
| 488 |
-
|
| 489 |
-
// Création d'un grand cube représentant 1000
|
| 490 |
-
const cubeGeometry = new THREE.BoxGeometry(8, 8, 8);
|
| 491 |
-
const cubeMaterial = new THREE.MeshPhongMaterial({
|
| 492 |
-
color: 0x8b5cf6,
|
| 493 |
-
transparent: true,
|
| 494 |
-
opacity: 0.8,
|
| 495 |
-
wireframe: false
|
| 496 |
-
});
|
| 497 |
-
const thousandCube = new THREE.Mesh(cubeGeometry, cubeMaterial);
|
| 498 |
-
thousandCube.position.y = 4;
|
| 499 |
-
thousandCube.castShadow = true;
|
| 500 |
-
scene.add(thousandCube);
|
| 501 |
-
objects.push(thousandCube);
|
| 502 |
-
|
| 503 |
-
// Animation
|
| 504 |
-
setTimeout(() => {
|
| 505 |
-
animateObject(thousandCube, { y: 6 }, 1000);
|
| 506 |
-
}, 1000);
|
| 507 |
-
}
|
| 508 |
-
|
| 509 |
-
function demonstratePercentages() {
|
| 510 |
-
createMathBase();
|
| 511 |
-
|
| 512 |
-
// Création d'une grille 10x10
|
| 513 |
-
const group = new THREE.Group();
|
| 514 |
-
for (let x = 0; x < 10; x++) {
|
| 515 |
-
for (let y = 0; y < 10; y++) {
|
| 516 |
-
const geometry = new THREE.BoxGeometry(0.8, 0.8, 0.8);
|
| 517 |
-
const material = new THREE.MeshPhongMaterial({
|
| 518 |
-
color: y < 3 ? 0x3b82f6 : 0xdddddd,
|
| 519 |
-
transparent: true,
|
| 520 |
-
opacity: 0.9
|
| 521 |
-
});
|
| 522 |
-
const cube = new THREE.Mesh(geometry, material);
|
| 523 |
-
cube.position.set((x - 4.5) * 1, 0.5, (y - 4.5) * 1);
|
| 524 |
-
group.add(cube);
|
| 525 |
-
}
|
| 526 |
}
|
| 527 |
-
scene.add(group);
|
| 528 |
-
objects.push(group);
|
| 529 |
-
|
| 530 |
-
// Animation
|
| 531 |
-
setTimeout(() => {
|
| 532 |
-
animateObject(group, { rotation: { y: Math.PI * 2 } }, 2000);
|
| 533 |
-
}, 1000);
|
| 534 |
}
|
| 535 |
|
| 536 |
-
function
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
| 547 |
-
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
scene.add(ruler);
|
| 579 |
-
|
| 580 |
-
// Objets à mesurer
|
| 581 |
-
const smallCube = new THREE.Mesh(
|
| 582 |
-
new THREE.BoxGeometry(1.5, 1.5, 1.5),
|
| 583 |
-
new THREE.MeshPhongMaterial({ color: 0xef4444 })
|
| 584 |
-
);
|
| 585 |
-
smallCube.position.set(-3, 1, 0);
|
| 586 |
-
scene.add(smallCube);
|
| 587 |
-
|
| 588 |
-
const largeCube = new THREE.Mesh(
|
| 589 |
-
new THREE.BoxGeometry(3, 3, 3),
|
| 590 |
-
new THREE.MeshPhongMaterial({ color: 0x10b981 })
|
| 591 |
-
);
|
| 592 |
-
largeCube.position.set(3, 1.5, 0);
|
| 593 |
-
scene.add(largeCube);
|
| 594 |
-
|
| 595 |
-
// Animation
|
| 596 |
-
setTimeout(() => {
|
| 597 |
-
animateObject(smallCube, { x: -2, z: 2 }, 800);
|
| 598 |
-
animateObject(largeCube, { x: 2, z: 2 }, 800);
|
| 599 |
-
}, 1000);
|
| 600 |
-
}
|
| 601 |
-
|
| 602 |
-
function demonstrateStatistics() {
|
| 603 |
-
createMathBase();
|
| 604 |
-
|
| 605 |
-
// Diagramme en barres
|
| 606 |
-
const barChartGroup = new THREE.Group();
|
| 607 |
-
|
| 608 |
-
const bar1 = new THREE.Mesh(
|
| 609 |
-
new THREE.BoxGeometry(1, 3, 1),
|
| 610 |
-
new THREE.MeshPhongMaterial({ color: 0x3b82f6 })
|
| 611 |
-
);
|
| 612 |
-
bar1.position.set(-3, 1.5, 0);
|
| 613 |
-
barChartGroup.add(bar1);
|
| 614 |
-
|
| 615 |
-
const bar2 = new THREE.Mesh(
|
| 616 |
-
new THREE.BoxGeometry(1, 5, 1),
|
| 617 |
-
new THREE.MeshPhongMaterial({ color: 0xef4444 })
|
| 618 |
-
);
|
| 619 |
-
bar2.position.set(-1, 2.5, 0);
|
| 620 |
-
barChartGroup.add(bar2);
|
| 621 |
-
|
| 622 |
-
const bar3 = new THREE.Mesh(
|
| 623 |
-
new THREE.BoxGeometry(1, 2, 1),
|
| 624 |
-
new THREE.MeshPhongMaterial({ color: 0x10b981 })
|
| 625 |
-
);
|
| 626 |
-
bar3.position.set(1, 1, 0);
|
| 627 |
-
barChartGroup.add(bar3);
|
| 628 |
-
|
| 629 |
-
const bar4 = new THREE.Mesh(
|
| 630 |
-
new THREE.BoxGeometry(1, 6, 1),
|
| 631 |
-
new THREE.MeshPhongMaterial({ color: 0x8b5cf6 })
|
| 632 |
-
);
|
| 633 |
-
bar4.position.set(3, 3, 0);
|
| 634 |
-
barChartGroup.add(bar4);
|
| 635 |
-
|
| 636 |
-
scene.add(barChartGroup);
|
| 637 |
-
objects.push(barChartGroup);
|
| 638 |
-
|
| 639 |
-
// Animation
|
| 640 |
-
setTimeout(() => {
|
| 641 |
-
animateObject(barChartGroup, { rotation: { y: Math.PI / 4 } }, 1000);
|
| 642 |
-
}, 1000);
|
| 643 |
}
|
| 644 |
|
| 645 |
-
function
|
| 646 |
-
|
| 647 |
-
|
| 648 |
-
|
| 649 |
-
|
| 650 |
-
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
-
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
-
|
| 664 |
-
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
|
| 668 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 669 |
}
|
| 670 |
|
| 671 |
// Fonctions utilitaires
|
|
@@ -704,18 +508,18 @@
|
|
| 704 |
return group;
|
| 705 |
}
|
| 706 |
|
| 707 |
-
function
|
| 708 |
const group = new THREE.Group();
|
| 709 |
|
| 710 |
-
for (let i = 0; i <
|
| 711 |
-
const geometry = new THREE.BoxGeometry(
|
| 712 |
const material = new THREE.MeshPhongMaterial({
|
| 713 |
color: color,
|
| 714 |
transparent: true,
|
| 715 |
opacity: 0.9
|
| 716 |
});
|
| 717 |
const cube = new THREE.Mesh(geometry, material);
|
| 718 |
-
cube.position.set(xPos,
|
| 719 |
cube.castShadow = true;
|
| 720 |
group.add(cube);
|
| 721 |
}
|
|
@@ -740,6 +544,65 @@
|
|
| 740 |
return cube;
|
| 741 |
}
|
| 742 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 743 |
function animateGroup(group, target, duration, callback) {
|
| 744 |
const startPositions = [];
|
| 745 |
group.children.forEach(child => {
|
|
@@ -773,9 +636,9 @@
|
|
| 773 |
const startRotation = object.rotation.clone();
|
| 774 |
|
| 775 |
const changePos = new THREE.Vector3(
|
| 776 |
-
target.x !== undefined ? target.x - object.position.x : 0,
|
| 777 |
-
target.y !== undefined ? target.y - object.position.y : 0,
|
| 778 |
-
target.z !== undefined ? target.z - object.position.z : 0
|
| 779 |
);
|
| 780 |
|
| 781 |
const changeRot = new THREE.Vector3(
|
|
@@ -790,9 +653,11 @@
|
|
| 790 |
const elapsed = Date.now() - startTime;
|
| 791 |
const progress = Math.min(elapsed / duration, 1);
|
| 792 |
|
| 793 |
-
|
| 794 |
-
|
| 795 |
-
|
|
|
|
|
|
|
| 796 |
|
| 797 |
if (target.rotation) {
|
| 798 |
object.rotation.x = startRotation.x + changeRot.x * progress;
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Arithmétique Visuelle</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
|
| 9 |
<script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.min.js"></script>
|
|
|
|
| 24 |
width: 90%;
|
| 25 |
max-width: 600px;
|
| 26 |
}
|
| 27 |
+
.operation-btn {
|
| 28 |
transition: all 0.3s ease;
|
| 29 |
filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
|
| 30 |
}
|
| 31 |
+
.operation-btn:hover {
|
| 32 |
transform: translateY(-5px) scale(1.05);
|
| 33 |
}
|
| 34 |
+
.active-operation {
|
| 35 |
transform: scale(1.1);
|
| 36 |
box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
|
| 37 |
}
|
| 38 |
+
.experience-btn {
|
| 39 |
+
transition: all 0.2s ease;
|
| 40 |
+
}
|
| 41 |
+
.experience-btn:hover {
|
| 42 |
+
transform: scale(1.1);
|
| 43 |
+
}
|
| 44 |
+
.active-experience {
|
| 45 |
+
background-color: rgba(59, 130, 246, 0.2);
|
| 46 |
+
border: 2px solid rgba(59, 130, 246, 0.8);
|
| 47 |
+
}
|
| 48 |
</style>
|
| 49 |
</head>
|
| 50 |
<body>
|
| 51 |
<div id="math-container"></div>
|
| 52 |
|
| 53 |
<div class="control-panel bg-white bg-opacity-90 p-4 rounded-xl shadow-xl">
|
| 54 |
+
<div class="grid grid-cols-4 gap-2 mb-4">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
<!-- Addition -->
|
| 56 |
+
<button onclick="loadOperation('addition')" class="operation-btn bg-green-50 p-3 rounded-lg flex items-center justify-center">
|
| 57 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 58 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/>
|
| 59 |
</svg>
|
| 60 |
</button>
|
| 61 |
|
| 62 |
<!-- Soustraction -->
|
| 63 |
+
<button onclick="loadOperation('subtraction')" class="operation-btn bg-red-50 p-3 rounded-lg flex items-center justify-center">
|
| 64 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-red-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 65 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 12H4"/>
|
| 66 |
</svg>
|
| 67 |
</button>
|
| 68 |
|
| 69 |
<!-- Multiplication -->
|
| 70 |
+
<button onclick="loadOperation('multiplication')" class="operation-btn bg-yellow-50 p-3 rounded-lg flex items-center justify-center">
|
| 71 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-yellow-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 72 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/>
|
| 73 |
</svg>
|
| 74 |
</button>
|
| 75 |
|
| 76 |
<!-- Division -->
|
| 77 |
+
<button onclick="loadOperation('division')" class="operation-btn bg-purple-50 p-3 rounded-lg flex items-center justify-center">
|
| 78 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 text-purple-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 79 |
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 12h14M5 12a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v4a2 2 0 01-2 2M5 12a2 2 0 00-2 2v4a2 2 0 002 2h14a2 2 0 002-2v-4a2 2 0 00-2-2"/>
|
| 80 |
</svg>
|
| 81 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
</div>
|
| 83 |
|
| 84 |
+
<div id="experience-buttons" class="grid grid-cols-3 gap-2 hidden">
|
| 85 |
+
<!-- Les boutons d'expérience seront ajoutés dynamiquement ici -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
</div>
|
| 87 |
</div>
|
| 88 |
|
| 89 |
<script>
|
| 90 |
// Initialisation Three.js
|
| 91 |
+
let scene, camera, renderer, controls, activeOperation = 'addition';
|
| 92 |
const objects = [];
|
| 93 |
|
| 94 |
function init() {
|
|
|
|
| 145 |
window.addEventListener('resize', onWindowResize);
|
| 146 |
|
| 147 |
// Chargement initial
|
| 148 |
+
loadOperation('addition');
|
| 149 |
}
|
| 150 |
|
| 151 |
function onWindowResize() {
|
|
|
|
| 154 |
renderer.setSize(window.innerWidth, window.innerHeight);
|
| 155 |
}
|
| 156 |
|
| 157 |
+
// Fonctions de chargement des opérations
|
| 158 |
+
function loadOperation(operation) {
|
| 159 |
+
activeOperation = operation;
|
| 160 |
clearScene();
|
| 161 |
updateActiveButton();
|
| 162 |
+
createExperienceButtons(operation);
|
| 163 |
|
| 164 |
+
// Charger la première expérience par défaut
|
| 165 |
+
loadExperience(operation, 1);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
function createExperienceButtons(operation) {
|
| 169 |
+
const container = document.getElementById('experience-buttons');
|
| 170 |
+
container.innerHTML = '';
|
| 171 |
+
container.classList.remove('hidden');
|
| 172 |
+
|
| 173 |
+
let experiences = [];
|
| 174 |
+
|
| 175 |
+
switch(operation) {
|
| 176 |
case 'addition':
|
| 177 |
+
experiences = ['1', '2', '3'];
|
| 178 |
break;
|
| 179 |
case 'subtraction':
|
| 180 |
+
experiences = ['1', '2', '3'];
|
| 181 |
break;
|
| 182 |
case 'multiplication':
|
| 183 |
+
experiences = ['1', '2', '3'];
|
| 184 |
break;
|
| 185 |
case 'division':
|
| 186 |
+
experiences = ['1', '2', '3'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
break;
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
experiences.forEach((exp, index) => {
|
| 191 |
+
const btn = document.createElement('button');
|
| 192 |
+
btn.className = 'experience-btn bg-gray-100 p-2 rounded-lg flex items-center justify-center';
|
| 193 |
+
btn.innerHTML = `
|
| 194 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
| 195 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
|
| 196 |
+
</svg>
|
| 197 |
+
`;
|
| 198 |
+
btn.onclick = () => loadExperience(operation, index + 1);
|
| 199 |
+
container.appendChild(btn);
|
| 200 |
+
});
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
function loadExperience(operation, experienceNumber) {
|
| 204 |
+
clearScene();
|
| 205 |
+
createMathBase();
|
| 206 |
+
|
| 207 |
+
// Mettre à jour le bouton d'expérience actif
|
| 208 |
+
updateActiveExperienceButton(experienceNumber);
|
| 209 |
+
|
| 210 |
+
switch(operation) {
|
| 211 |
+
case 'addition':
|
| 212 |
+
demonstrateAddition(experienceNumber);
|
| 213 |
break;
|
| 214 |
+
case 'subtraction':
|
| 215 |
+
demonstrateSubtraction(experienceNumber);
|
| 216 |
break;
|
| 217 |
+
case 'multiplication':
|
| 218 |
+
demonstrateMultiplication(experienceNumber);
|
| 219 |
break;
|
| 220 |
+
case 'division':
|
| 221 |
+
demonstrateDivision(experienceNumber);
|
| 222 |
break;
|
| 223 |
}
|
| 224 |
}
|
| 225 |
|
| 226 |
function updateActiveButton() {
|
| 227 |
+
document.querySelectorAll('.operation-btn').forEach(btn => {
|
| 228 |
+
btn.classList.remove('active-operation');
|
| 229 |
});
|
| 230 |
|
| 231 |
+
const activeBtn = document.querySelector(`[onclick="loadOperation('${activeOperation}')"]`);
|
| 232 |
if (activeBtn) {
|
| 233 |
+
activeBtn.classList.add('active-operation');
|
| 234 |
}
|
| 235 |
}
|
| 236 |
|
| 237 |
+
function updateActiveExperienceButton(experienceNumber) {
|
| 238 |
+
const buttons = document.querySelectorAll('#experience-buttons button');
|
| 239 |
+
buttons.forEach((btn, index) => {
|
| 240 |
+
if (index === experienceNumber - 1) {
|
| 241 |
+
btn.classList.add('active-experience');
|
| 242 |
+
} else {
|
| 243 |
+
btn.classList.remove('active-experience');
|
| 244 |
+
}
|
| 245 |
+
});
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
function clearScene() {
|
| 249 |
// Supprimer tous les objets sauf les lumières et helpers
|
| 250 |
const toRemove = [];
|
|
|
|
| 258 |
objects.length = 0;
|
| 259 |
}
|
| 260 |
|
| 261 |
+
// Fonctions de démonstration des opérations avec différentes expériences
|
| 262 |
+
function demonstrateAddition(experienceNumber) {
|
| 263 |
+
switch(experienceNumber) {
|
| 264 |
+
case 1:
|
| 265 |
+
// Expérience 1: Addition simple avec sphères
|
| 266 |
+
const group1 = createSphereGroup(3, -4, 0, 0x3b82f6);
|
| 267 |
+
const group2 = createSphereGroup(2, 4, 0, 0xef4444);
|
| 268 |
+
|
| 269 |
+
setTimeout(() => {
|
| 270 |
+
animateGroup(group2, { x: -1, y: 0, z: 0 }, 1000, () => {
|
| 271 |
+
const resultGroup = createSphereGroup(5, 0, 0, 0x10b981);
|
| 272 |
+
animateGroup(resultGroup, { y: 2 }, 800);
|
| 273 |
+
});
|
| 274 |
+
}, 1000);
|
| 275 |
+
break;
|
| 276 |
+
|
| 277 |
+
case 2:
|
| 278 |
+
// Expérience 2: Addition avec cubes empilés
|
| 279 |
+
const base1 = createNumberTower(3, -3, 0, 0x3b82f6);
|
| 280 |
+
const base2 = createNumberTower(2, 3, 0, 0xef4444);
|
| 281 |
+
|
| 282 |
+
setTimeout(() => {
|
| 283 |
+
animateGroup(base2, { x: 0 }, 1000, () => {
|
| 284 |
+
const resultTower = createNumberTower(5, 0, 0, 0x10b981);
|
| 285 |
+
animateGroup(resultTower, { y: 1 }, 800);
|
| 286 |
+
});
|
| 287 |
+
}, 1000);
|
| 288 |
+
break;
|
| 289 |
+
|
| 290 |
+
case 3:
|
| 291 |
+
// Expérience 3: Addition avec formes géométriques
|
| 292 |
+
const cube1 = createAlgebraCube(1, -4, 0.5, 0x3b82f6);
|
| 293 |
+
const cube2 = createAlgebraCube(1, -2, 0.5, 0x3b82f6);
|
| 294 |
+
const cube3 = createAlgebraCube(1, 2, 0.5, 0xef4444);
|
| 295 |
+
|
| 296 |
+
setTimeout(() => {
|
| 297 |
+
animateObject(cube3, { x: 0 }, 1000, () => {
|
| 298 |
+
const bigCube = createAlgebraCube(2, 0, 1, 0x10b981);
|
| 299 |
+
animateObject(bigCube, { y: 2 }, 800);
|
| 300 |
+
});
|
| 301 |
+
}, 1000);
|
| 302 |
+
break;
|
| 303 |
}
|
| 304 |
}
|
| 305 |
|
| 306 |
+
function demonstrateSubtraction(experienceNumber) {
|
| 307 |
+
switch(experienceNumber) {
|
| 308 |
+
case 1:
|
| 309 |
+
// Expérience 1: Soustraction simple avec sphères
|
| 310 |
+
const initialGroup = createSphereGroup(5, 0, 0, 0x3b82f6);
|
| 311 |
+
|
| 312 |
+
setTimeout(() => {
|
| 313 |
+
const removedGroup = createSphereGroup(2, 0, 0, 0xef4444);
|
| 314 |
+
animateGroup(removedGroup, { x: 3, y: 0, z: 0 }, 1000, () => {
|
| 315 |
+
const resultGroup = createSphereGroup(3, -3, 0, 0x10b981);
|
| 316 |
+
animateGroup(resultGroup, { y: 2 }, 800);
|
| 317 |
+
});
|
| 318 |
+
}, 1000);
|
| 319 |
+
break;
|
| 320 |
+
|
| 321 |
+
case 2:
|
| 322 |
+
// Expérience 2: Soustraction avec tours
|
| 323 |
+
const initialTower = createNumberTower(5, 0, 0, 0x3b82f6);
|
| 324 |
+
|
| 325 |
+
setTimeout(() => {
|
| 326 |
+
const removedTower = createNumberTower(2, 0, 0, 0xef4444);
|
| 327 |
+
animateGroup(removedTower, { x: 3 }, 1000, () => {
|
| 328 |
+
const resultTower = createNumberTower(3, -3, 0, 0x10b981);
|
| 329 |
+
animateGroup(resultTower, { y: 1 }, 800);
|
| 330 |
+
});
|
| 331 |
+
}, 1000);
|
| 332 |
+
break;
|
| 333 |
+
|
| 334 |
+
case 3:
|
| 335 |
+
// Expérience 3: Soustraction avec formes géométriques
|
| 336 |
+
const bigCube = createAlgebraCube(2, 0, 1, 0x3b82f6);
|
| 337 |
+
|
| 338 |
+
setTimeout(() => {
|
| 339 |
+
const smallCube = createAlgebraCube(1, 0, 0.5, 0xef4444);
|
| 340 |
+
animateObject(smallCube, { x: 3 }, 1000, () => {
|
| 341 |
+
const remainingCube = createAlgebraCube(1, -3, 0.5, 0x10b981);
|
| 342 |
+
animateObject(remainingCube, { y: 2 }, 800);
|
| 343 |
+
});
|
| 344 |
+
}, 1000);
|
| 345 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 346 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 347 |
}
|
| 348 |
|
| 349 |
+
function demonstrateMultiplication(experienceNumber) {
|
| 350 |
+
switch(experienceNumber) {
|
| 351 |
+
case 1:
|
| 352 |
+
// Expérience 1: Multiplication comme addition répétée
|
| 353 |
+
const group1 = createSphereGroup(4, -3, -2, 0x3b82f6);
|
| 354 |
+
const group2 = createSphereGroup(4, -3, 0, 0x3b82f6);
|
| 355 |
+
const group3 = createSphereGroup(4, -3, 2, 0x3b82f6);
|
| 356 |
+
|
| 357 |
+
setTimeout(() => {
|
| 358 |
+
animateGroup(group1, { x: 0, z: -2 }, 800);
|
| 359 |
+
animateGroup(group2, { x: 0, z: 0 }, 800);
|
| 360 |
+
animateGroup(group3, { x: 0, z: 2 }, 800, () => {
|
| 361 |
+
const resultGroup = createSphereGroup(12, 3, 0, 0x10b981);
|
| 362 |
+
animateGroup(resultGroup, { y: 2 }, 800);
|
| 363 |
+
});
|
| 364 |
+
}, 1000);
|
| 365 |
+
break;
|
| 366 |
+
|
| 367 |
+
case 2:
|
| 368 |
+
// Expérience 2: Multiplication avec tableau
|
| 369 |
+
createMultiplicationGrid(3, 4);
|
| 370 |
+
break;
|
| 371 |
+
|
| 372 |
+
case 3:
|
| 373 |
+
// Expérience 3: Multiplication avec aires
|
| 374 |
+
const rectangle = createRectangle(3, 4, 0, 0, 0x3b82f6);
|
| 375 |
+
|
| 376 |
+
setTimeout(() => {
|
| 377 |
+
animateObject(rectangle, { rotation: { y: Math.PI/4 } }, 1000, () => {
|
| 378 |
+
const areaCube = createAlgebraCube(1, 0, 0.5, 0x10b981);
|
| 379 |
+
for (let i = 0; i < 12; i++) {
|
| 380 |
+
setTimeout(() => {
|
| 381 |
+
const clone = areaCube.clone();
|
| 382 |
+
clone.position.set(Math.random() * 6 - 3, 0.5, Math.random() * 6 - 3);
|
| 383 |
+
scene.add(clone);
|
| 384 |
+
objects.push(clone);
|
| 385 |
+
}, i * 100);
|
| 386 |
+
}
|
| 387 |
+
});
|
| 388 |
+
}, 1000);
|
| 389 |
+
break;
|
| 390 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
}
|
| 392 |
|
| 393 |
+
function demonstrateDivision(experienceNumber) {
|
| 394 |
+
switch(experienceNumber) {
|
| 395 |
+
case 1:
|
| 396 |
+
// Expérience 1: Division comme soustraction répétée
|
| 397 |
+
const initialGroup = createSphereGroup(12, 0, 0, 0x3b82f6);
|
| 398 |
+
|
| 399 |
+
setTimeout(() => {
|
| 400 |
+
const group1 = createSphereGroup(4, -3, -2, 0xef4444);
|
| 401 |
+
const group2 = createSphereGroup(4, -3, 0, 0xef4444);
|
| 402 |
+
const group3 = createSphereGroup(4, -3, 2, 0xef4444);
|
| 403 |
+
|
| 404 |
+
setTimeout(() => {
|
| 405 |
+
animateGroup(group1, { x: -3, z: -2 }, 800);
|
| 406 |
+
animateGroup(group2, { x: -3, z: 0 }, 800);
|
| 407 |
+
animateGroup(group3, { x: -3, z: 2 }, 800);
|
| 408 |
+
}, 1000);
|
| 409 |
+
}, 1000);
|
| 410 |
+
break;
|
| 411 |
+
|
| 412 |
+
case 2:
|
| 413 |
+
// Expérience 2: Division avec tours
|
| 414 |
+
const initialTower = createNumberTower(12, 0, 0, 0x3b82f6);
|
| 415 |
+
|
| 416 |
+
setTimeout(() => {
|
| 417 |
+
const tower1 = createNumberTower(4, -3, -2, 0xef4444);
|
| 418 |
+
const tower2 = createNumberTower(4, -3, 0, 0xef4444);
|
| 419 |
+
const tower3 = createNumberTower(4, -3, 2, 0xef4444);
|
| 420 |
+
|
| 421 |
+
setTimeout(() => {
|
| 422 |
+
animateGroup(tower1, { x: -5, z: -2 }, 800);
|
| 423 |
+
animateGroup(tower2, { x: -5, z: 0 }, 800);
|
| 424 |
+
animateGroup(tower3, { x: -5, z: 2 }, 800);
|
| 425 |
+
}, 1000);
|
| 426 |
+
}, 1000);
|
| 427 |
+
break;
|
| 428 |
+
|
| 429 |
+
case 3:
|
| 430 |
+
// Expérience 3: Division avec parts égales
|
| 431 |
+
const circleGeometry = new THREE.CircleGeometry(3, 32);
|
| 432 |
+
|
| 433 |
+
// Création de 4 parts égales
|
| 434 |
+
for (let i = 0; i < 4; i++) {
|
| 435 |
+
const startAngle = (i * Math.PI) / 2;
|
| 436 |
+
const endAngle = ((i + 1) * Math.PI) / 2;
|
| 437 |
+
|
| 438 |
+
const shape = new THREE.Shape();
|
| 439 |
+
shape.moveTo(0, 0);
|
| 440 |
+
|
| 441 |
+
for (let angle = startAngle; angle <= endAngle; angle += 0.1) {
|
| 442 |
+
const x = Math.cos(angle) * 3;
|
| 443 |
+
const y = Math.sin(angle) * 3;
|
| 444 |
+
shape.lineTo(x, y);
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
shape.lineTo(Math.cos(endAngle) * 3, Math.sin(endAngle) * 3);
|
| 448 |
+
shape.lineTo(0, 0);
|
| 449 |
+
|
| 450 |
+
const part = new THREE.Mesh(
|
| 451 |
+
new THREE.ShapeGeometry(shape),
|
| 452 |
+
new THREE.MeshPhongMaterial({
|
| 453 |
+
color: [0x3b82f6, 0xef4444, 0x10b981, 0x8b5cf6][i],
|
| 454 |
+
side: THREE.DoubleSide
|
| 455 |
+
})
|
| 456 |
+
);
|
| 457 |
+
part.position.set(0, 0.1, 0);
|
| 458 |
+
scene.add(part);
|
| 459 |
+
objects.push(part);
|
| 460 |
+
|
| 461 |
+
setTimeout(() => {
|
| 462 |
+
animateObject(part, {
|
| 463 |
+
position: {
|
| 464 |
+
x: Math.cos(startAngle + Math.PI/4) * 2,
|
| 465 |
+
z: Math.sin(startAngle + Math.PI/4) * 2
|
| 466 |
+
},
|
| 467 |
+
rotation: { y: Math.PI/2 }
|
| 468 |
+
}, 1000);
|
| 469 |
+
}, i * 300 + 1000);
|
| 470 |
+
}
|
| 471 |
+
break;
|
| 472 |
+
}
|
| 473 |
}
|
| 474 |
|
| 475 |
// Fonctions utilitaires
|
|
|
|
| 508 |
return group;
|
| 509 |
}
|
| 510 |
|
| 511 |
+
function createNumberTower(count, xPos, zPos, color) {
|
| 512 |
const group = new THREE.Group();
|
| 513 |
|
| 514 |
+
for (let i = 0; i < count; i++) {
|
| 515 |
+
const geometry = new THREE.BoxGeometry(1, 1, 1);
|
| 516 |
const material = new THREE.MeshPhongMaterial({
|
| 517 |
color: color,
|
| 518 |
transparent: true,
|
| 519 |
opacity: 0.9
|
| 520 |
});
|
| 521 |
const cube = new THREE.Mesh(geometry, material);
|
| 522 |
+
cube.position.set(xPos, i * 1.1 + 0.5, zPos);
|
| 523 |
cube.castShadow = true;
|
| 524 |
group.add(cube);
|
| 525 |
}
|
|
|
|
| 544 |
return cube;
|
| 545 |
}
|
| 546 |
|
| 547 |
+
function createMultiplicationGrid(rows, cols) {
|
| 548 |
+
const group = new THREE.Group();
|
| 549 |
+
|
| 550 |
+
for (let x = 0; x < cols; x++) {
|
| 551 |
+
for (let y = 0; y < rows; y++) {
|
| 552 |
+
const geometry = new THREE.BoxGeometry(0.8, 0.8, 0.8);
|
| 553 |
+
const material = new THREE.MeshPhongMaterial({
|
| 554 |
+
color: (x + y) % 2 === 0 ? 0x3b82f6 : 0xef4444,
|
| 555 |
+
transparent: true,
|
| 556 |
+
opacity: 0.9
|
| 557 |
+
});
|
| 558 |
+
const cube = new THREE.Mesh(geometry, material);
|
| 559 |
+
cube.position.set((x - cols/2 + 0.5) * 1, 0.5, (y - rows/2 + 0.5) * 1);
|
| 560 |
+
group.add(cube);
|
| 561 |
+
}
|
| 562 |
+
}
|
| 563 |
+
|
| 564 |
+
scene.add(group);
|
| 565 |
+
objects.push(group);
|
| 566 |
+
|
| 567 |
+
setTimeout(() => {
|
| 568 |
+
animateObject(group, { rotation: { y: Math.PI } }, 1000, () => {
|
| 569 |
+
const resultCube = createAlgebraCube(1, 0, 0.5, 0x10b981);
|
| 570 |
+
for (let i = 0; i < rows * cols; i++) {
|
| 571 |
+
setTimeout(() => {
|
| 572 |
+
const clone = resultCube.clone();
|
| 573 |
+
clone.position.set(Math.random() * 6 - 3, 0.5, Math.random() * 6 - 3);
|
| 574 |
+
scene.add(clone);
|
| 575 |
+
objects.push(clone);
|
| 576 |
+
}, i * 100);
|
| 577 |
+
}
|
| 578 |
+
});
|
| 579 |
+
}, 1000);
|
| 580 |
+
|
| 581 |
+
return group;
|
| 582 |
+
}
|
| 583 |
+
|
| 584 |
+
function createRectangle(width, height, xPos, zPos, color) {
|
| 585 |
+
const shape = new THREE.Shape();
|
| 586 |
+
shape.moveTo(0, 0);
|
| 587 |
+
shape.lineTo(width, 0);
|
| 588 |
+
shape.lineTo(width, height);
|
| 589 |
+
shape.lineTo(0, height);
|
| 590 |
+
shape.lineTo(0, 0);
|
| 591 |
+
|
| 592 |
+
const geometry = new THREE.ShapeGeometry(shape);
|
| 593 |
+
const material = new THREE.MeshPhongMaterial({
|
| 594 |
+
color: color,
|
| 595 |
+
side: THREE.DoubleSide
|
| 596 |
+
});
|
| 597 |
+
const rectangle = new THREE.Mesh(geometry, material);
|
| 598 |
+
rectangle.position.set(xPos - width/2, 0.1, zPos - height/2);
|
| 599 |
+
rectangle.rotation.x = -Math.PI / 2;
|
| 600 |
+
scene.add(rectangle);
|
| 601 |
+
objects.push(rectangle);
|
| 602 |
+
|
| 603 |
+
return rectangle;
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
function animateGroup(group, target, duration, callback) {
|
| 607 |
const startPositions = [];
|
| 608 |
group.children.forEach(child => {
|
|
|
|
| 636 |
const startRotation = object.rotation.clone();
|
| 637 |
|
| 638 |
const changePos = new THREE.Vector3(
|
| 639 |
+
target.position?.x !== undefined ? target.position.x - object.position.x : 0,
|
| 640 |
+
target.position?.y !== undefined ? target.position.y - object.position.y : 0,
|
| 641 |
+
target.position?.z !== undefined ? target.position.z - object.position.z : 0
|
| 642 |
);
|
| 643 |
|
| 644 |
const changeRot = new THREE.Vector3(
|
|
|
|
| 653 |
const elapsed = Date.now() - startTime;
|
| 654 |
const progress = Math.min(elapsed / duration, 1);
|
| 655 |
|
| 656 |
+
if (target.position) {
|
| 657 |
+
object.position.x = startPosition.x + changePos.x * progress;
|
| 658 |
+
object.position.y = startPosition.y + changePos.y * progress;
|
| 659 |
+
object.position.z = startPosition.z + changePos.z * progress;
|
| 660 |
+
}
|
| 661 |
|
| 662 |
if (target.rotation) {
|
| 663 |
object.rotation.x = startRotation.x + changeRot.x * progress;
|