Commit c35174a0 authored by Nicaudie Charlotte's avatar Nicaudie Charlotte

Added turtle2js file

parent 2a030e18
let program2c out (p : MJ.program) : unit =
fprintf out
"<!DOCTYPE html>\n\
<html>\n\
<head>\n\
<meta charset=\"utf-8\">\n\
<title>%a</title>\n\
<style type=\"text/css\">\n\
html, body {\n\
margin: 0;\n\
}\n\
\n\
html {\n\
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n\
height: 100%;\n\
}\n\
\n\
body {\n\
overflow: hidden;\n\
height: inherit;\n\
}\n\
\n\
h1 {\n\
font-size: 2rem;\n\
letter-spacing: -1px;\n\
position: absolute;\n\
margin: 0;\n\
top: -4px;\n\
right: 5px;\n\
\n\
color: transparent;\n\
text-shadow: 0 0 4px white;\n\
}\n\
</style>\n\
</head>\n\
\n\
<body>\n\
<h1>%a</h1>\n\
<canvas></canvas>\n\
<script>\n\
// Canvas setup\n\
const canvas = document.querySelector('canvas');\n\
const ctx = canvas.getContext('2d');\n\
\n\
const width = canvas.width = window.innerWidth;\n\
const height = canvas.height = window.innerHeight;\n\
\n\
// Function to generate a random number\n\
\n\
function random(min,max) {\n\
const num = Math.floor(Math.random()*(max-min)) + min;\n\
return num;\n\
}\n\
\n\
// Variables\n\
%a\
\n\
// Methods\n\
%a\
\n\
// Animation\n\
function loop() {\n\
%a\n\
requestAnimationFrame(loop);\n\
}\n\
loop();\n\
</script>\n\
</body>\n\
</html>\n\"
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment