Advertisement
allcoma

allcoma3

Sep 29th, 2014
436
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.36 KB | None | 0 0
  1. <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  2.  
  3. <title>путешествие во времени</title>
  4.  
  5. <style type="text/css">
  6.  
  7. div {
  8. border: 0px solid black;
  9. width:50px;
  10. height:50px;
  11. float:left;
  12. margin: auto;
  13. text-align: center;
  14. }
  15.  
  16. #log {text-align:right;}
  17.  
  18. </style>
  19.  
  20.  
  21. <script type="text/javascript">
  22.  
  23. function init(d, r, g, b, r1, g1, b1)
  24. {
  25. d.colors = new Array();
  26. d.colors.push(r);
  27. d.colors.push(g);
  28. d.colors.push(b);
  29. d.colors.push(r1);
  30. d.colors.push(g1);
  31. d.colors.push(b1);
  32. }
  33.  
  34. function zapusk(d)
  35. {
  36.  
  37. s = '#';
  38. for (var i = 0; i < 3; i++)
  39. {
  40. d.colors[i] += d.colors[i + 3];
  41. if (d.colors[i] < 0)
  42. {
  43. d.colors[i] = 0;
  44. d.colors[i + 3] = -d.colors[i + 3];
  45. }
  46. if (d.colors[i] > 0xff)
  47. {
  48. d.colors[i] = 0xff;
  49. d.colors[i + 3] = -d.colors[i + 3];
  50. }
  51.  
  52. s1 = Math.floor(d.colors[i]).toString(16);
  53. while (s1.length < 2)
  54. {
  55. s1 = '0' + s1;
  56. }
  57.  
  58. s += s1;
  59. }
  60.  
  61. d.style.backgroundColor = s;
  62.  
  63. }
  64.  
  65.  
  66. window.onload=function(){
  67.  
  68. var n=(((Math.ceil(Math.random() *2))*255))-255; // черно белое 0 и 255 случайно
  69. var o = 1111; // число скачков
  70. var m = 12345; // пройденное время в секундах
  71. var a = 9999999999; // пройденное время в секундах максимальное
  72. var b = 0.001; // 1 цвет в солько секундах
  73. var c = a/b; // такой цвет через пройденное время
  74. var t = 255; // диапазон количество цветов
  75. var f = Math.floor(c);
  76. var u = c/t;
  77. var q = Math.floor(u);
  78. var z = t*q;
  79. var x = f-z;
  80. var e = Math.floor(c)-t*(Math.floor((c)/t)); // перевод такого цвета через пройденное время  в заданный диапазон цветов
  81. var v = Math.floor(a/b)-t*(Math.floor((a/b)/t)); // перевод такого цвета через пройденное время  в заданный диапазон цветов
  82. var p = (((Math.floor(a/b)-t*(Math.floor((a/b)/t)))*o)+(Math.floor(m/b)-t*(Math.floor((m/b)/t)))); // скачки во времени
  83. var r = Math.floor((((Math.floor(a/b)-t*(Math.floor((a/b)/t)))*o)+(Math.floor(m/b)-t*(Math.floor((m/b)/t)))))-t*(Math.floor(((((Math.floor(a/b)-t*(Math.floor((a/b)/t)))*o)+(Math.floor(m/b)-t*(Math.floor((m/b)/t)))))/t)); // скачки во времени  в заданный диапазон цветов
  84. var s = (((Math.ceil(r *2))*255))-255; // скачек в черно белое 0 и 255 случайно
  85. var h = 3; // шаг цветов
  86.  
  87. init(document.getElementById('cvet1'), 1, 1, Math.floor((((Math.floor(a/(b+1))-t*(Math.floor((a/(b+1))/t)))*o)+(Math.floor(m/(b+1))-t*(Math.floor((m/(b+1))/t)))))-t*(Math.floor(((((Math.floor(a/(b+1))-t*(Math.floor((a/(b+1))/t)))*o)+(Math.floor(m/(b+1))-t*(Math.floor((m/(b+1))/t)))))/t)), 1, 1, h);
  88. init(document.getElementById('cvet2'), 1, 1, Math.floor((((Math.floor(a/(b+2))-t*(Math.floor((a/(b+2))/t)))*o)+(Math.floor(m/(b+2))-t*(Math.floor((m/(b+2))/t)))))-t*(Math.floor(((((Math.floor(a/(b+2))-t*(Math.floor((a/(b+2))/t)))*o)+(Math.floor(m/(b+2))-t*(Math.floor((m/(b+2))/t)))))/t)), 1, 1, h);
  89. init(document.getElementById('cvet3'), 1, 1, Math.floor((((Math.floor(a/(b+3))-t*(Math.floor((a/(b+3))/t)))*o)+(Math.floor(m/(b+3))-t*(Math.floor((m/(b+3))/t)))))-t*(Math.floor(((((Math.floor(a/(b+3))-t*(Math.floor((a/(b+3))/t)))*o)+(Math.floor(m/(b+3))-t*(Math.floor((m/(b+3))/t)))))/t)), 1, 1, h);
  90. init(document.getElementById('cvet4'), 1, 1, Math.floor((((Math.floor(a/(b+4))-t*(Math.floor((a/(b+4))/t)))*o)+(Math.floor(m/(b+4))-t*(Math.floor((m/(b+4))/t)))))-t*(Math.floor(((((Math.floor(a/(b+4))-t*(Math.floor((a/(b+4))/t)))*o)+(Math.floor(m/(b+4))-t*(Math.floor((m/(b+4))/t)))))/t)), 1, 1, h);
  91.  
  92. setInterval(function(){zapusk(document.getElementById('cvet1'))}, 1);
  93. setInterval(function(){zapusk(document.getElementById('cvet2'))}, 2);
  94. setInterval(function(){zapusk(document.getElementById('cvet3'))}, 3);
  95. setInterval(function(){zapusk(document.getElementById('cvet4'))}, 4);
  96.  
  97. }
  98.  
  99. </script>
  100. </head>
  101.  
  102. <body>
  103.  
  104. <div style="width:100px; height:100px; border:0px">
  105. <div id="cvet1"style="background-color: rgb(0, 0, 0);"></div>
  106. <div id="cvet2"style="background-color: rgb(0, 0, 0);"></div>
  107. <div id="cvet3"style="background-color: rgb(0, 0, 0);"></div>
  108. <div id="cvet4"style="background-color: rgb(0, 0, 0);"></div>
  109. </div>
  110.  
  111. <div id="log">#ffffff</div>
  112. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement