А почему Вы решили, что я не умею определять расстояние между двумя точками?
|
Yurok_shnurok,
Вариант ))) <div></div> <script type="text/javascript"> var i = 0; document.onmousemove = function () { document.getElementsByTagName("div")[0].innerHTML = i > 100 ? 0 : ++i / 100; window.setTimeout(function (a) { return function () { if (a == i) { i && v_in_div(i); i = -1 } } }(i), 20) }; function v_in_div(a) { b = document.createElement("div"); b.style.cssText = "height: 5px;width: " + a + "px;background-color: " + (a > 50 ? "#FF0000" : "#00FF00"); document.body.appendChild(b) }; </script> |
Цитата:
<style>div {float:left;} *{margin:0;padding:0}</style> <script type="text/javascript"> X=Y=d=0 document.onmousemove = function(e){ var x=e.clientX,y=e.clientY; with(Math) {d+=floor(sqrt(pow(x-X,2)+pow(y-Y,2))/3)} X=x;Y=y; }; setInterval(function(){document.body.appendChild(document.createElement("div")).style.cssText = 'width:1px;height:'+d+'px;background-color:rgb('+(d<255?d:255)+',0,0)';d=0;},100) </script> |
а зачем на 3 делил??? при расчете гипотенузы?
|
Чтоб красиво вписалось в окошко ответа, не более.)
|
Часовой пояс GMT +3, время: 19:24. |