Math
How do I make an math?
What is a math? How do you make a math? This script and codes were developed by Darryl Huffman on 07 January 2023, Saturday.
Math - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Math</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Math - Script Codes CSS Codes
html, body { width: 100%; height: 100%; margin: 0px; padding: 0px; overflow: hidden; background-color: #111;
}
canvas { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
Math - Script Codes JS Codes
// DICE ROLL = 1-6
var positions = { 1: [3,1], 2: [3,1], 3: [5,5], 4: [5,5], 5: [1,5], 6: [1,5]
};
var container = 'body';
var size = { x: $(container).width(), y: $(container).height(), scale: 0
};
if(size.x >= size.y){ size.x = size.y;
} else { size.y = size.x;
}
size.scale = size.x/5;
var pointer = { x: Math.floor(Math.random() * 6 + 1), y: Math.floor(Math.random() * 6 + 1)
}
var canvas = $('<canvas/>').attr({width: size.x, height: size.y}).appendTo(container), context = canvas.get(0).getContext("2d");
window.requestFrame = (function(){ return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function( callback ){ window.setTimeout(callback, 1000 / 60); };
})();
context.clearRect(0,0,size.x,size.y);
context.fillStyle = "#FF0000";
context.fillRect((pointer.x-0.5)*size.scale, (pointer.y-0.5)*size.scale, 8, 8);
context.fillStyle = "#FFFFFF";
function render(){ var c = Math.floor(Math.random() * 6 + 1); var toPos = positions[c]; var nextPointerPos = {}; nextPointerPos.x = pointer.x + (toPos[0] - pointer.x) / 2; nextPointerPos.y = pointer.y + (toPos[1] - pointer.y) / 2; context.fillRect((nextPointerPos.x-0.5)*size.scale, (nextPointerPos.y-0.5)*size.scale, 1, 1); pointer = nextPointerPos; //setTimeout(render, 1); requestFrame(render);
}
render();
Developer | Darryl Huffman |
Username | darrylhuffman |
Uploaded | January 07, 2023 |
Rating | 3.5 |
Size | 2,495 Kb |
Views | 8,096 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
LightBulb | 2,561 Kb |
End of the Rainbow | 3,722 Kb |
A Perfect Orbit | 3,411 Kb |
Pixelot | 3,080 Kb |
Let it snow, let it snow, code the snow. | 2,884 Kb |
Hot Arrrr Balloon. | 2,755 Kb |
A Different Clock | 3,613 Kb |
Spilled Galaxy | 2,163 Kb |
Spilled Paint | 3,894 Kb |
Spilled Paint v2 | 4,275 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Hovers with popups | Zacharyolson | 2,380 Kb |
Rotate Demo | Agelber | 3,061 Kb |
Pure CSS Tooltips | Mobius1 | 2,271 Kb |
TigerWoods Freecodecamp Page | Baileytj | 2,869 Kb |
Drifting Clouds | Benedikte | 2,247 Kb |
Caputre Cam with JS | KimmoCommit | 2,795 Kb |
Portfolio page | Bhavya_j | 2,804 Kb |
AOR site logo | Thatbram | 2,527 Kb |
Sign Up Form | Sicontis | 5,272 Kb |
404 Error Page | WebSonick | 3,203 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!