~firefox
firefoxsintest.html
5 days ago• 9
{}
<html>
<head>
<style type="text/css">
.tbl { display: table; table-layout: fixed; width: 100%; }
.tr { display: table-row; }
.td { display: table-cell; text-align: left; }
.td:nth-child(1) { display: table-cell; text-align: center; }
</style>
<script type="text/javascript">
var $=function(id) { return document.getElementById(id); };
</script>
</head>
<body>
rad=Math.PI / 180<br />
sinloops=(360 / 512) * 20<br />
<br />
sinloop=i * sinloops<br />
sintest=(Math.sin(sinloop * rad) * .25) + .75<br />
<br />
20 cycles 0.5 to 1 across 512(ie pixels nightvision)~
<br />
<br />
<hr />
<div id="sintest"></div>
<script type="text/javascript">
var rad=Math.PI / 180;
var sinloops=(360 / 512) * 20;
var sinloop=0;
var sintest=0;
var costest=0;
var html="<div class='tbl'>";
html+="<div class='tr'>";
html+="<div class='td'>i=</div>";
html+="<div class='td'>sinloop=</div>";
html+="<div class='td' style='width: 100px;'> </div>";
html+="<div class='td' style='width: 100px;'> </div>";
html+="<div class='td'>sintest=</div>";
//html+="<div class='td'>costest=</div>";
html+="</div>";
html+="<div class='tr'>";
html+="<div class='td'> </div>";
html+="<div class='td'> </div>";
html+="<div class='td'> </div>";
html+="<div class='td'> </div>";
html+="<div class='td'> </div>";
html+="</div>";
for(var i=0;i<512;i++) {
sinloop=i * sinloops;
sintest=(Math.sin(sinloop * rad) * .25) + .75;
sinleft=Math.round(((sintest * 2) - 1)*100);
//costest=Math.cos(sinloop * rad);
html+="<div class='tr'>";
html+="<div class='td'>"+i+"</div>";
html+="<div class='td'>"+sinloop+"</div>";
html+="<div class='td'><div style='position:relative;width:100%;height:100%;'> <div style='position:absolute;width:10px;height:100%;background:#000;left:"+sinleft+"%;'> </div></div></div>";
html+="<div class='td'></div>";
html+="<div class='td'>"+sintest+"</div>";
//html+="<div class='td'>"+costest+"</div>";
html+="</div>";
}
html+="</div>";
$('sintest').innerHTML=html;
</script>
</body>
</html>
Top
2 190 417 visits