|
1 |
| -// docoument.getElementById('kewl').background='r'; |
| 1 | +function escape_mouse(event) { |
| 2 | + img = document.getElementById('pop-plankton'); |
| 3 | + console.log(document.location); |
2 | 4 |
|
3 |
| -// var edge = [0,2,3][Math.floor(Math.random() * 3)]; |
4 |
| -// var rotation = Math.random() * 0.1 - 0.05 + (edge * 0.25); |
| 5 | + var hpos = -(50 + Math.floor(Math.random() * 10)) + 'px'; |
| 6 | + var vpos = (Math.floor(Math.random() * 80) + 10) + '%'; |
| 7 | + var rotation = Math.random() * 0.2 - 0.1 + (0.75); |
5 | 8 |
|
6 |
| -// var edges = ['bottom', 'right', 'top', 'right'] |
| 9 | + console.log(img, '' + vpos); |
7 | 10 |
|
8 |
| -// var vpos = edges[edge]+':-'+(50+Math.floor(Math.random()*10))+'px;'; |
9 |
| -// var hpos = edges[(edge+1)%4]+':'+(Math.floor(Math.random()*70)+5)+'%;'; |
| 11 | + img.style.right = "-200px"; |
10 | 12 |
|
11 |
| -var edge = [0,2,3][Math.floor(Math.random() * 3)]; |
12 |
| -var rotation = Math.random() * 0.1 - 0.05 + (0.75); |
13 |
| - |
14 |
| -var vpos = 'right:-'+(50+Math.floor(Math.random()*10))+'px;'; |
15 |
| -var hpos = 'bottom:'+(Math.floor(Math.random()*80)+10)+'%;'; |
| 13 | + setTimeout(function () { |
| 14 | + img.style.bottom = '' + vpos; |
| 15 | + img.style.transform = "rotate(" + rotation * 360 + "deg)"; |
| 16 | + img.style.right = '' + hpos; |
| 17 | + }, 700); |
| 18 | +} |
16 | 19 |
|
17 |
| -// console.log(vpos,hpos) |
| 20 | +var rotation = Math.random() * 0.1 - 0.05 + (0.75); |
| 21 | +var hpos = 'right:-' + (50 + Math.floor(Math.random() * 10)) + 'px;'; |
| 22 | +var vpos = 'bottom:' + (Math.floor(Math.random() * 80) + 10) + '%;'; |
18 | 23 |
|
19 | 24 | var img = document.createElement("img");
|
20 |
| -img.src = "../_images/plankton-only.svg"; |
| 25 | +img.src = document.location.pathname.split('/').slice(0,8).join("/")+"/_images/plankton-only.svg";//"../_images/plankton-only.svg"; |
21 | 26 | img.id = "pop-plankton";
|
| 27 | +img.onmouseenter = escape_mouse; |
22 | 28 | img.width = 100;
|
23 | 29 | img.height = 100;
|
24 |
| -img.style = "transform:rotate(" + rotation * 360 + "deg);position:fixed;z-score:5 ;"+vpos+hpos;//#"+Math.random()*100+"vw;"; |
25 |
| - |
| 30 | +img.style = "transform:rotate(" + rotation * 360 + "deg);position:fixed;z-score:5 ;" + vpos + hpos;//#"+Math.random()*100+"vw;"; |
26 | 31 |
|
27 | 32 | document.addEventListener("DOMContentLoaded", function (event) {
|
28 | 33 | console.log(img);
|
29 |
| - |
30 | 34 | var canvas = document.getElementsByClassName('wy-nav-content-wrap')[0];
|
31 | 35 | canvas.appendChild(img);
|
32 | 36 | });
|
0 commit comments