11<!DOCTYPE html>
22< html lang ="en ">
3+
34< head >
45 < meta charset ="UTF-8 ">
56 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
1516 font-family : monospace;
1617 color : # 888 ;
1718 }
19+
1820 # calculator-bezel {
1921 background-color : # e0e0e0 ;
2022 padding : 20px ;
2123 border-radius : 15px ;
22- box-shadow : 0 10px 30px rgba (0 , 0 , 0 , 0.5 );
24+ box-shadow : 0 10px 30px rgba (0 , 0 , 0 , 0.5 );
2325 display : flex;
2426 flex-direction : column;
2527 align-items : center;
2628 }
29+
2730 canvas {
2831 background-color : # 000 ;
2932 border : 2px solid # 999 ;
3033 /* Ensures crisp scaling on high-DPI screens */
31- image-rendering : pixelated;
34+ image-rendering : pixelated;
3235 image-rendering : crisp-edges;
3336 width : 320px ;
3437 height : 528px ;
35- box-shadow : inset 0 0 10px rgba (0 , 0 , 0 , 0.8 );
38+ box-shadow : inset 0 0 10px rgba (0 , 0 , 0 , 0.8 );
3639 }
40+
3741 .controls {
3842 margin-top : 10px ;
3943 font-size : 12px ;
4044 }
45+
46+ html {
47+ overflow : hidden;
48+ }
4149 </ style >
4250</ head >
51+
4352< body >
4453
4554 < div id ="calculator-bezel ">
4655 <!-- Canvas size matches calculator resolution exactly -->
4756 < canvas id ="screen " width ="320 " height ="528 "> </ canvas >
48- < div class ="controls "> PythonExtra JS Simulator • 320x528</ div >
4957 </ div >
5058
5159 < script >
124132
125133 function dtext_opt ( x , y , fg , bg , halign , valign , text ) {
126134 ctx . font = '16px "Courier New", monospace' ;
127- ctx . textAlign = halign ;
128-
135+ ctx . textAlign = halign ;
136+
129137 if ( valign === DTEXT_TOP ) ctx . textBaseline = 'top' ;
130138 else if ( valign === DTEXT_BOTTOM ) ctx . textBaseline = 'bottom' ;
131139 else ctx . textBaseline = 'middle' ;
141149 // 3D Cube Data
142150 const VERTICES = [
143151 [ - 1 , - 1 , - 1 ] , [ 1 , - 1 , - 1 ] , [ 1 , 1 , - 1 ] , [ - 1 , 1 , - 1 ] ,
144- [ - 1 , - 1 , 1 ] , [ 1 , - 1 , 1 ] , [ 1 , 1 , 1 ] , [ - 1 , 1 , 1 ]
152+ [ - 1 , - 1 , 1 ] , [ 1 , - 1 , 1 ] , [ 1 , 1 , 1 ] , [ - 1 , 1 , 1 ]
145153 ] ;
146154
147155 const EDGES = [
148- [ 0 , 1 ] , [ 1 , 2 ] , [ 2 , 3 ] , [ 3 , 0 ] ,
149- [ 4 , 5 ] , [ 5 , 6 ] , [ 6 , 7 ] , [ 7 , 4 ] ,
150- [ 0 , 4 ] , [ 1 , 5 ] , [ 2 , 6 ] , [ 3 , 7 ]
156+ [ 0 , 1 ] , [ 1 , 2 ] , [ 2 , 3 ] , [ 3 , 0 ] ,
157+ [ 4 , 5 ] , [ 5 , 6 ] , [ 6 , 7 ] , [ 7 , 4 ] ,
158+ [ 0 , 4 ] , [ 1 , 5 ] , [ 2 , 6 ] , [ 3 , 7 ]
151159 ] ;
152160
153161 // State variables
184192 let ny = x * s + y * c ;
185193 x = nx ; y = ny ;
186194 }
187- return { x, y, z} ;
195+ return { x, y, z } ;
188196 }
189197
190198 // Animation Loop Control
225233 // Background Grid
226234 const grid_col = C_RGB ( 6 , 6 , 6 ) ;
227235 const grid_speed = ( t * 50 ) % 40 ;
228-
236+
229237 for ( let i = 0 ; i < HEIGHT / 2 ; i += 40 ) {
230238 const y_pos = HEIGHT - i + grid_speed ;
231239 if ( y_pos < HEIGHT ) {
242250 for ( let v of VERTICES ) {
243251 const p = rotate_point ( v [ 0 ] , v [ 1 ] , v [ 2 ] , angle_x , angle_y , angle_z ) ;
244252 const dist = 4 ;
245- const z_factor = 1 / ( dist - p . z ) ;
253+ const z_factor = 1 / ( dist - p . z ) ;
246254
247255 // Floor coordinates for pixel perfection
248256 const px = Math . floor ( p . x * scale_base * z_factor + CX ) ;
249257 const py = Math . floor ( p . y * scale_base * z_factor + CY + y_offset ) ;
250258
251- projected_points . push ( { x : px , y : py } ) ;
259+ projected_points . push ( { x : px , y : py } ) ;
252260 }
253261
254262 for ( let edge of EDGES ) {
277285
278286 </ script >
279287</ body >
280- </ html >
288+
289+ </ html >
0 commit comments