diff --git a/experiment/simulation/LettersPage/SmaQ/curved arrow.gif b/experiment/simulation/LettersPage/SmaQ/curved arrow.gif new file mode 100644 index 0000000..1e1a94c Binary files /dev/null and b/experiment/simulation/LettersPage/SmaQ/curved arrow.gif differ diff --git a/experiment/simulation/LettersPage/SmaQ/index.html b/experiment/simulation/LettersPage/SmaQ/index.html new file mode 100644 index 0000000..88e9e39 --- /dev/null +++ b/experiment/simulation/LettersPage/SmaQ/index.html @@ -0,0 +1,312 @@ + + + + + + + Connect Dots + + + + + +
+ +
+
+
+
+ + + + + Overlay Image + Overlay Image + Overlay Image + + + +
+ + + + + \ No newline at end of file diff --git a/experiment/simulation/LettersPage/SmaQ/main.css b/experiment/simulation/LettersPage/SmaQ/main.css new file mode 100644 index 0000000..7f58f3f --- /dev/null +++ b/experiment/simulation/LettersPage/SmaQ/main.css @@ -0,0 +1,105 @@ +* { + margin: 0; + padding: 0; + font-family: Arial, Helvetica, sans-serif; + box-sizing: border-box; /* Ensures padding and border are included in width/height calculations */ + z-index: -4; +} + +.simulation-container { + background-color: rgba(220, 229, 236, 1); + width: 100%; /* Responsive width */ + max-width: 1000px; /* Max width to maintain design integrity */ + min-height: 800px; /* Minimum height */ + margin: 20px auto; /* Auto margins for centering */ + z-index: 0; + display: grid; + justify-items: center; + +} + +.title { + margin: 0; + padding: 5px; + letter-spacing: 0.1em; + background-color: rgb(0, 140, 255); + color: white; + display: flex; + justify-content: center; + width: 100%; /* Ensure it fills the container */ + height: 60%; +} + +.instruction-main { + position: relative; + display: grid; + justify-content: center; + z-index: 0; + font-family: Georgia, 'Times New Roman', Times, serif; + height: 10%; + bottom: 40%; + font-size: 50px; + margin-top: 20px; +} + +.instruction-main1 { + position: relative; + display: grid; + justify-content: center; + z-index: 0; + bottom: 100%; + height: 10%; + + +} + +.rules { + position: relative; + display: flex; + justify-content: start; + z-index: 0; + + height: 10%; + bottom: 45px; + font-size: 150%; + left: -40%; +} + +.rule { + position: relative; + display: flex; + justify-content: start; + z-index: 0; + font-family: Georgia, 'Times New Roman', Times, serif; + + + left: -100px; + bottom: 80px; + +} + +.congrats { + position: relative; + display: none; + justify-content: start; + z-index: 0; + height: 10%; + top: 80%; + font-size: 150%; + +} + +.next-exp { + position: absolute; + display: none; + left: 75%; + transform: translateX(-50%); /* Centering button horizontally */ + padding: 10px 15px; + color: white; + background-color: rgb(20, 117, 228); + font-weight: 600; + border: none; + border-radius: 4px; + cursor: pointer; + bottom: 30px; +} \ No newline at end of file diff --git a/experiment/simulation/LettersPage/SmaQ/p-stroke.png b/experiment/simulation/LettersPage/SmaQ/p-stroke.png new file mode 100644 index 0000000..e39dd0e Binary files /dev/null and b/experiment/simulation/LettersPage/SmaQ/p-stroke.png differ diff --git a/experiment/simulation/LettersPage/SmaQ/q-new.png b/experiment/simulation/LettersPage/SmaQ/q-new.png new file mode 100644 index 0000000..2fcdaa5 Binary files /dev/null and b/experiment/simulation/LettersPage/SmaQ/q-new.png differ diff --git a/experiment/simulation/LettersPage/SmaQ/q.css b/experiment/simulation/LettersPage/SmaQ/q.css new file mode 100644 index 0000000..2cf8a18 --- /dev/null +++ b/experiment/simulation/LettersPage/SmaQ/q.css @@ -0,0 +1,141 @@ +body { + display: flex; + justify-content: center; + /* Center horizontally */ + align-items: center; + /* Center vertically */ + height: 100vh; + /* Full height of the viewport */ + margin: 0; + /* Remove default margin */ +} + +#canvas-container { + position: relative; + width: 400px; + height: 400px; + border: 1px solid black; + display: flex; + justify-content: center; + align-items: center; +} + +#canvas { + position: absolute; + top: 0; + left: 0; + border: 1px solid black; + z-index: 10; + cursor: url('data:image/x-icon;base64,AAACAAEAICAQAAAAAADoAgAAFgAAACgAAAAgAAAAQAAAAAEABAAAAAAAAAIAAAAAAAAAAAAAEAAAAAAAAAAAAAAAhYWFAPqv6ADgm4sASkpKAJ/l7QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACIAAAAAAAAAAAAAAAAAAAEiIAAAAAAAAAAAAAAAAAAxEiIAAAAAAAAAAAAAAAADMxEgAAAAAAAAAAAAAAAAMzMxAAAAAAAAAAAAAAAAAzMzMAAAAAAAAAAAAAAAADMzMwAAAAAAAAAAAAAAAAMzMzAAAAAAAAAAAAAAAAAzMzMAAAAAAAAAAAAAAAADMzMwAAAAAAAAAAAAAAAABTMzAAAAAAAAAAAAAAAAAFVTMAAAAAAAAAAAAAAAAABFVQAAAAAAAAAAAAAAAAAARAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////////////////////////////////////////////////////////////////////////////////P////h////wP///4H///8D///+B////A////gf///wP///4H///+D////B////w////8///////////////w=='), auto; +} + +.dot { + + position: absolute; + width: 10px; + height: 10px; + background-color: red; + border-radius: 50%; + transform: translate(-50%, -50%); +} + +.dot4 { + + position: absolute; + width: 10px; + height: 10px; + background-color: red; + border-radius: 50%; + transform: translate(-50%, -50%); + display: none; +} + + + + +#stroke1 { + + display: none; + position: absolute; + top: 90px; + left: 258px; + width: 11px; + height: 310px; + + +} + +#stroke2 { + + display: none; + position: absolute; + top: 85px; + left: 92px; + width: 181px; + height: 235px; + +} + +#stroke3 { + + display: none; + position: absolute; + top: 175px; + left: 233px; + width: 15px; + height: 200px; + transform: rotate(145deg); + z-index: -1; + +} + +#sbox { + position: relative; + left: 115px; + width: 400px; + height: 400px; + z-index: -2; + display: none; +} + +#trace { + position: relative; + bottom: 20px; + right: 90px; + width: 600px; + height: 550px; + z-index: -10; +} + +.arrrow1 { + + position: absolute; + top: 80px; + left: 290px; + width: 40px; + height: 240px; + transform: rotate(180deg); + z-index: -1; +} + +.arrrow2 { + display: none; + position: absolute; + top: 90px; + left: 140px; + width: 50px; + height: 100px; + transform: rotate(250deg); + z-index: -1; +} + +.arrrow3 { + display: none; + position: absolute; + top: 200px; + left: 310px; + width: 20px; + height: 110px; + transform: rotate(180deg); + z-index: 0; +} \ No newline at end of file diff --git a/experiment/simulation/LettersPage/SmaQ/q.html b/experiment/simulation/LettersPage/SmaQ/q.html new file mode 100644 index 0000000..b95bc09 --- /dev/null +++ b/experiment/simulation/LettersPage/SmaQ/q.html @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + Virtual Labs + + + + + +
+ +

Lettering

+

Letter q

+ +

Rules-

+

1] Draw the line in the direction of the arrow on the trace of the letter.

+

2] To draw, click on the starting point and drag the cursor to end point .

+ +
+ +
+
+
+
+ + + + + Overlay Image + Overlay Image + Overlay Image + + + +
+ +

Congrats you have learnt to draw Letter q

+ + + + + +
+ + + + + + + \ No newline at end of file diff --git a/experiment/simulation/LettersPage/SmaQ/q.js b/experiment/simulation/LettersPage/SmaQ/q.js new file mode 100644 index 0000000..cf61554 --- /dev/null +++ b/experiment/simulation/LettersPage/SmaQ/q.js @@ -0,0 +1,135 @@ + + const canvas = document.getElementById('canvas'); + const ctx = canvas.getContext('2d'); + const dot1 = document.getElementById('dot1'); + const dot2 = document.getElementById('dot2'); + const dot3 = document.getElementById('dot3'); + const dot4 = document.getElementById('dot4'); // Added reference to dot4 + const stroke1 = document.getElementById('stroke1'); + const stroke2 = document.getElementById('stroke2'); + + const arrow1 = document.getElementById('arrow1'); + const arrow2 = document.getElementById('arrow2'); + + let isDrawing = false; + let startX = 0; + let startY = 0; + let tolerance = 30; + let nextConnection = 'dot4-dot2'; // Start with connecting dot4 to dot2 (reversed) + + arrow1.style.display = 'none'; // Initially, arrow1 is hidden, arrow2 is shown + arrow2.style.display = 'block'; + + function checkDotTolerance(dot, x, y) { + return Math.hypot(x - (dot.offsetLeft + 5), y - (dot.offsetTop + 5)) <= tolerance; + } + + function drawToleranceCircle(dot, ctx) { + ctx.beginPath(); + ctx.arc(dot.offsetLeft + 5, dot.offsetTop + 5, tolerance, 0, 2 * Math.PI); + ctx.strokeStyle = 'rgba(255, 200, 0, 0.5)'; + ctx.stroke(); + } + + function startDrawing(e) { + const rect = canvas.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + let targetDot; + + switch (nextConnection) { + case 'dot4-dot2': // Now starts with dot4 to dot2 + targetDot = dot4; + break; + case 'dot3-dot1': // The second connection is now dot3 to dot1 + targetDot = dot3; + break; + } + + if (!checkDotTolerance(targetDot, x, y)) { + alert('Please follow rules and draw accordingly. Try again!'); + return; + } + + ctx.clearRect(0, 0, canvas.width, canvas.height); + drawToleranceCircle(targetDot, ctx); + drawToleranceCircle(nextConnection.includes('dot4') ? dot4 : targetDot, ctx); + + isDrawing = true; + startX = targetDot.offsetLeft + 5; + startY = targetDot.offsetTop + 5; + } + + function draw(e) { + if (!isDrawing) return; + const rect = canvas.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + ctx.beginPath(); + ctx.moveTo(startX, startY); + ctx.lineTo(x, y); + ctx.stroke(); + startX = x; + startY = y; + ctx.strokeStyle = 'black'; + ctx.lineWidth = 6; + } + + function stopDrawing(e) { + if (!isDrawing) return; + const rect = canvas.getBoundingClientRect(); + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + let targetDot; + + switch (nextConnection) { + case 'dot4-dot2': // Now handles dot4 to dot2 first + targetDot = dot2; + break; + case 'dot3-dot1': // Then handles dot3 to dot1 + targetDot = dot1; + break; + } + + if (checkDotTolerance(targetDot, x, y)) { + console.log('Stopped drawing near', targetDot.id); + let strokeId; + switch (nextConnection) { + case 'dot4-dot2': + strokeId = '2'; + nextConnection = 'dot3-dot1'; // Change the next connection to dot3-dot1 + arrow2.style.display = 'none'; + arrow1.style.display = 'block'; + dot4.style.display = 'none'; // Hide dot4 + dot2.style.display = 'none'; // Hide dot2 + dot3.style.display = 'block'; // Show dot3 + dot3.style.zIndex = '10'; + stroke2.style.zIndex = '-1'; + + dot1.style.display = 'block'; // Show dot1 + dot1.style.zIndex = '10'; + break; + case 'dot3-dot1': // Handle the second connection case + strokeId = '1'; + arrow1.style.display = 'none'; + dot3.style.display = 'none'; + dot1.style.display = 'none'; + button.style.display = 'block'; + congrats.style.display = 'block'; + break; + } + + if (strokeId) { + document.getElementById('stroke' + strokeId).style.display = 'block'; + } + ctx.clearRect(0, 0, canvas.width, canvas.height); + } else { + alert('Complete the line near the correct dot. Try Again!'); + ctx.clearRect(0, 0, canvas.width, canvas.height); + } + isDrawing = false; + } + + canvas.addEventListener('mousedown', startDrawing); + canvas.addEventListener('mousemove', draw); + canvas.addEventListener('mouseup', stopDrawing); diff --git a/experiment/simulation/LettersPage/SmaQ/sboxx.png b/experiment/simulation/LettersPage/SmaQ/sboxx.png new file mode 100644 index 0000000..bc30ae9 Binary files /dev/null and b/experiment/simulation/LettersPage/SmaQ/sboxx.png differ diff --git a/experiment/simulation/LettersPage/SmaQ/stroke1.png b/experiment/simulation/LettersPage/SmaQ/stroke1.png new file mode 100644 index 0000000..3f06a3c Binary files /dev/null and b/experiment/simulation/LettersPage/SmaQ/stroke1.png differ diff --git a/experiment/simulation/LettersPage/SmaQ/without-bg.gif b/experiment/simulation/LettersPage/SmaQ/without-bg.gif new file mode 100644 index 0000000..455420f Binary files /dev/null and b/experiment/simulation/LettersPage/SmaQ/without-bg.gif differ