113 lines
4.2 KiB
HTML
113 lines
4.2 KiB
HTML
<!--
|
|
This work is licensed under CC BY-NC-ND 4.0
|
|
Link to license: http://creativecommons.org/licenses/by-nc-nd/4.0/
|
|
Attribute to Russell Georgi
|
|
-->
|
|
<html>
|
|
<head>
|
|
<title>
|
|
Waves X-ray
|
|
</title>
|
|
<style>
|
|
html, body {
|
|
width: 100%;
|
|
height: 100%;
|
|
margin: 0px;
|
|
border: 0;
|
|
overflow: hidden;
|
|
display: block;
|
|
}
|
|
|
|
canvas {
|
|
position: absolute;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<canvas id="myCanvas" width="1" height="1" style="border:1px solid #ffffff;">
|
|
Your browser does not support the HTML5 canvas tag.</canvas>
|
|
|
|
<script>
|
|
var c = document.getElementById("myCanvas");
|
|
var ctx = c.getContext("2d");
|
|
ctx.canvas.width = window.innerWidth;
|
|
ctx.canvas.height = window.innerHeight;
|
|
|
|
var scrwidth = (c.width / 3);
|
|
var lclr = ["#aa00aa", "#aa0000", "#ff5555", "#ffff55", "#55ff55","#00aa00", "#5555ff", "#0000aa"];
|
|
var xPos = 0;
|
|
var yPos = 00;
|
|
var m = 1;
|
|
var t0 = 0;
|
|
/// ??? ///
|
|
var th = 0;
|
|
|
|
|
|
ctx.translate(ctx.canvas.width / 2, ctx.canvas.height / 2);
|
|
ctx.scale(1.5, -1.5);
|
|
|
|
|
|
function Clear(ctx)
|
|
{
|
|
ctx.clearRect(-c.width, -c.height, c.width * 2, c.height * 2);
|
|
}
|
|
|
|
function Update()
|
|
{
|
|
Draw();
|
|
m += 1;
|
|
setTimeout(Update, 1000/60)
|
|
}
|
|
|
|
function Draw()
|
|
{
|
|
Clear(ctx);
|
|
cth = Math.cos(th);
|
|
sth = Math.sin(th);
|
|
for (j = 0; j <= 21; j++)
|
|
{
|
|
ctx.strokeStyle = lclr[j % 8];
|
|
ctx.beginPath();
|
|
ctx.moveTo(xPos + scrwidth * (j - 10.6) / 10, yPos - 150);
|
|
ctx.lineTo(xPos + scrwidth * (j - 10.6) / 10, yPos + 100);
|
|
ctx.stroke();
|
|
ctx.scale(1, -1);
|
|
ctx.scale(1, -1);
|
|
}
|
|
vector(-50, -25, 90, -25, 10, "#000000");
|
|
}
|
|
|
|
window.addEventListener('resize', function(event) {
|
|
c.width = window.innerWidth;
|
|
c.height = window.innerHeight;
|
|
ctx.translate(c.width / 2, c.height / 2);
|
|
ctx.scale(1.5, -1.5);
|
|
}, true);
|
|
|
|
|
|
function vector(xv, yv, xvv, yvv, va, cl)
|
|
{
|
|
vl = ((xvv - xv) ** 2 + Math.pow(yvv - yv, 2)) ** (1/2);
|
|
ctx.strokeStyle = cl;
|
|
ctx.beginPath();
|
|
ctx.moveTo(xPos + xv, yPos + yv);
|
|
ctx.lineTo(xPos + xvv, yPos + yvv);
|
|
ctx.stroke();
|
|
ctx.beginPath();
|
|
ctx.moveTo(xPos + xvv, yPos + yvv);
|
|
ctx.lineTo(xPos + xvv - va / vl * (xvv - xv) + va / vl / 2 * (yvv - yv), yPos + yvv - va / vl * (yvv - yv) - va / vl / 2 * (xvv - xv));
|
|
ctx.stroke();
|
|
ctx.beginPath();
|
|
ctx.moveTo(xPos + xvv, yPos + yvv);
|
|
ctx.lineTo(xPos + xvv - va / vl * (xvv - xv) - va / vl / 2 * (yvv - yv), yPos + yvv - va / vl * (yvv - yv) + va / vl / 2 * (xvv - xv));
|
|
ctx.stroke();
|
|
}
|
|
|
|
Update();
|
|
|
|
</script>
|
|
</body>
|
|
<p xmlns:cc="http://creativecommons.org/ns#" style="font-size: 1vw; bottom: 0px; position: absolute;">
|
|
This work is licensed under
|
|
<a href="http://creativecommons.org/licenses/by-nc-nd/4.0/?ref=chooser-v1" target="_blank" rel="license noopener noreferrer" style="display:inline-block;">CC BY-NC-ND 4.0<img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/cc.svg?ref=chooser-v1"><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/by.svg?ref=chooser-v1"><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/nc.svg?ref=chooser-v1"><img style="height:22px!important;margin-left:3px;vertical-align:text-bottom;" src="https://mirrors.creativecommons.org/presskit/icons/nd.svg?ref=chooser-v1"></a></p>
|
|
</html> |