| 
						
						
							
								
							
						
						
					 | 
					@ -16,8 +16,8 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						let cFrames = 0; | 
					 | 
					 | 
						let cFrames = 0; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						let isCapturing = false; | 
					 | 
					 | 
						let isCapturing = false; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
						const totalCFrames = 600; // Number of frames to capture
 | 
					 | 
					 | 
						let frame_array = [] | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
						const zip = new JSZip(); // Create a new JSZip instance
 | 
					 | 
					 | 
						const totalCFrames = 1200; // Number of frames to capture
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
						let captureFrames = false; | 
					 | 
					 | 
						let captureFrames = false; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						 | 
					 | 
					 | 
						 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						let containerW = container_element.offsetWidth | 
					 | 
					 | 
						let containerW = container_element.offsetWidth | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -144,30 +144,34 @@ | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
							renderer.setSize(containerW, containerH) | 
					 | 
					 | 
							renderer.setSize(containerW, containerH) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						}) | 
					 | 
					 | 
						}) | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					// Function to capture the canvas and save it as PNG data in the zip
 | 
					 | 
					 | 
						function captureFrame() { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					function captureFrame() { | 
					 | 
					 | 
							renderer.domElement.toDataURL('image/png').replace("image/png", "image/octet-stream"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					const canvas = renderer.domElement; | 
					 | 
					 | 
							let imgData = renderer.domElement.toDataURL("image/png"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					canvas.toBlob((blob) => { | 
					 | 
					 | 
							frame_array.push(imgData); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        // Add the blob to the ZIP archive
 | 
					 | 
					 | 
							cFrames++; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        zip.file(`frame-${cFrames}.png`, blob); | 
					 | 
					 | 
						 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        cFrames++; | 
					 | 
					 | 
							// If last frame, prepare the download
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
							if (cFrames === totalCFrames) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        // If all frames are captured, zip and download
 | 
					 | 
					 | 
								prepareDownload(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (cFrames >= totalCFrames) { | 
					 | 
					 | 
							} | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            zipAndDownload(); | 
					 | 
					 | 
						} | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        } | 
					 | 
					 | 
						 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    }, 'image/png'); | 
					 | 
					 | 
					function prepareDownload() { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					} | 
					 | 
					 | 
						let zip = new JSZip(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					
 | 
					 | 
					 | 
						console.log('zipping..') | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					// Function to zip and download the frames
 | 
					 | 
					 | 
						frame_array.forEach((dataUrl, index) => { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					function zipAndDownload() { | 
					 | 
					 | 
							let imgData = dataUrl.split(',')[1]; // Get base64 data part
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    zip.generateAsync({ type: 'blob' }).then(function (content) { | 
					 | 
					 | 
							zip.file(`frame_${index.toString().padStart(4, '0')}.png`, imgData, {base64: true}); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        // Create a download link for the zip file
 | 
					 | 
					 | 
						}); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        const link = document.createElement('a'); | 
					 | 
					 | 
						console.log('zipped!') | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        link.href = URL.createObjectURL(content); | 
					 | 
					 | 
						zip.generateAsync({type: "blob"}) | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        link.download = 'frames.zip'; | 
					 | 
					 | 
						.then(function(content) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        link.click(); | 
					 | 
					 | 
							const a = document.createElement("a"); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					    }); | 
					 | 
					 | 
							a.href = URL.createObjectURL(content); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							a.download = "frames.zip"; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							console.log('zip dl ready!') | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							a.click(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
						}); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					} | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					// Event listener for the spacebar key press
 | 
					 | 
					 | 
					// Event listener for the spacebar key press
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -176,15 +180,15 @@ document.addEventListener('keydown', (event) => { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      isCapturing = !isCapturing; // Toggle capturing
 | 
					 | 
					 | 
					      isCapturing = !isCapturing; // Toggle capturing
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      if (isCapturing) { | 
					 | 
					 | 
					      if (isCapturing) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
							cFrames = 0; // Reset frame counter
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        captureFrames = true | 
					 | 
					 | 
					        captureFrames = true | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        console.log('Capture started...'); | 
					 | 
					 | 
					        console.log('Capture started...'); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      } else { | 
					 | 
					 | 
					      } else { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        captureFrames = false | 
					 | 
					 | 
					        captureFrames = false | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        cFrames = 0; // Reset frame counter
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        console.log('Capture paused...'); | 
					 | 
					 | 
					        console.log('Capture paused...'); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					      } | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					  }); | 
					 | 
					 | 
					}); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
						init() | 
					 | 
					 | 
						init() | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |