dollcrds

beomgyu ju mp cursor

May 4th, 2022
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.54 KB | None | 0 0
  1. <script>
  2.  
  3. var b = document.body;
  4. var imgurl = "https://dl.dropbox.com/s/0cpxf4csr9iygls/Photo%20Oct%2024%2C%201%2009%2038%20PM.gif";
  5. var size = [10, 20];
  6. function rand(min, max)
  7. {
  8. return Math.floor(Math.random() * (max - min + 1) + min)
  9. }
  10. function getSize()
  11. {
  12. return rand(size[0], size[1]);
  13. }
  14. function lerp(a,b,f)
  15. {
  16. return (b-a)*f+a;
  17. }
  18. function heart(x,y)
  19. {
  20. var s = getSize();
  21. x -= s/2;
  22. y -= s/2;
  23. x = Math.floor(x) + rand(-5, 5);
  24. y = Math.floor(y) + rand(-5, 5);
  25. var fx = x + rand(-40, 40);
  26. var fy = y + rand(-40, 40);
  27. var i = document.createElement("img");
  28. i.src = imgurl;
  29. i.style = `pointer-events: none; position: fixed; width: ${s}px; left: ${x}px; top: ${y}px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; z-index: 1000000;`;
  30. b.appendChild(i);
  31. var f = 0;
  32. var interval;
  33. interval = setInterval(function() {
  34. var _x = Math.floor(lerp(x, fx, f));
  35. var _y = Math.floor(lerp(y, fy, f));
  36. i.style = `pointer-events: none; position: fixed; width: ${s}px; left: ${_x}px; top: ${_y}px; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; z-index: 1000000;`;
  37. i.style.opacity = 1-f;
  38. f += 0.01;
  39. if (f > 1)
  40. {
  41. clearInterval(interval);
  42. b.removeChild(i);
  43. }
  44. }, 10);
  45. }
  46. function bro(x,y)
  47. {
  48. for (var i = 0; i < 5; i++)
  49. {
  50. heart(x,y);
  51. }
  52. }
  53. b.addEventListener("click", function(event){
  54. var x = event.clientX;
  55. var y = event.clientY;
  56. bro(x,y);
  57. });
  58.  
  59. </script>
  60.  
  61. <script type="text/javascript">
  62. // <![CDATA[
  63. var colours=new Array('#89C5EA', '#EDEA7C', '#EDEA7C'); // colours of the hearts
  64. var minisize=15; // smallest size of hearts in pixels
  65. var maxisize=25; // biggest size of hearts in pixels
  66. var hearts=66; // maximum number of hearts on screen
  67. var over_or_under="over"; // set to "over" for hearts to always be on top, or "under" to allow them to float behind other objects
  68.  
  69. /*****************************
  70. *JavaScript Love Heart Cursor*
  71. * (c)2013+ mf2fm web-design *
  72. * http://www.mf2fm.com/rv *
  73. * DON'T EDIT BELOW THIS BOX *
  74. *****************************/
  75. var x=ox=400;
  76. var y=oy=300;
  77. var swide=800;
  78. var shigh=600;
  79. var sleft=sdown=0;
  80. var herz=new Array();
  81. var herzx=new Array();
  82. var herzy=new Array();
  83. var herzs=new Array();
  84. var kiss=false;
  85.  
  86. if (typeof('addRVLoadEvent')!='function') function addRVLoadEvent(funky) {
  87. var oldonload=window.onload;
  88. if (typeof(oldonload)!='function') window.onload=funky;
  89. else window.onload=function() {
  90. if (oldonload) oldonload();
  91. funky();
  92. }
  93. }
  94.  
  95. addRVLoadEvent(mwah);
  96.  
  97. function mwah() { if (document.getElementById) {
  98. var i, heart;
  99. for (i=0; i<hearts; i++) {
  100. heart=createDiv("auto", "auto");
  101. heart.style.visibility="hidden";
  102. heart.style.zIndex=(over_or_under=="over")?"1001":"0";
  103. heart.style.color=colours[i%colours.length];
  104. heart.style.pointerEvents="none";
  105. if (navigator.appName=="Microsoft Internet Explorer") heart.style.filter="alpha(opacity=75)";
  106. else heart.style.opacity=0.75;
  107. heart.appendChild(document.createTextNode(String.fromCharCode(9834)));
  108. document.body.appendChild(heart);
  109. herz[i]=heart;
  110. herzy[i]=false;
  111. }
  112. set_scroll();
  113. set_width();
  114. herzle();
  115. }}
  116.  
  117. function herzle() {
  118. var c;
  119. if (Math.abs(x-ox)>1 || Math.abs(y-oy)>1) {
  120. ox=x;
  121. oy=y;
  122. for (c=0; c<hearts; c++) if (herzy[c]===false) {
  123. herz[c].firstChild.nodeValue=String.fromCharCode(9834);
  124. herz[c].style.left=(herzx[c]=x-minisize/2)+"px";
  125. herz[c].style.top=(herzy[c]=y-minisize)+"px";
  126. herz[c].style.fontSize=minisize+"px";
  127. herz[c].style.fontWeight='normal';
  128. herz[c].style.visibility='visible';
  129. herzs[c]=minisize;
  130. break;
  131. }
  132. }
  133. for (c=0; c<hearts; c++) if (herzy[c]!==false) blow_me_a_kiss(c);
  134. setTimeout("herzle()", 40);
  135. }
  136.  
  137. document.onmousedown=pucker;
  138. document.onmouseup=function(){clearTimeout(kiss);};
  139.  
  140. function pucker() {
  141. ox=-1;
  142. oy=-1;
  143. kiss=setTimeout('pucker()', 100);
  144. }
  145.  
  146. function blow_me_a_kiss(i) {
  147. herzy[i]-=herzs[i]/minisize+i%2;
  148. herzx[i]+=(i%5-2)/5;
  149. if (herzy[i]<sdown-herzs[i] || herzx[i]<sleft-herzs[i] || herzx[i]>sleft+swide-herzs[i]) {
  150. herz[i].style.visibility="hidden";
  151. herzy[i]=false;
  152. }
  153. else if (herzs[i]>minisize+2 && Math.random()<.5/hearts) break_my_heart(i);
  154. else {
  155. if (Math.random()<maxisize/herzy[i] && herzs[i]<maxisize) herz[i].style.fontSize=(++herzs[i])+"px";
  156. herz[i].style.top=herzy[i]+"px";
  157. herz[i].style.left=herzx[i]+"px";
  158. }
  159. }
  160.  
  161. function break_my_heart(i) {
  162. var t;
  163. herz[i].firstChild.nodeValue=String.fromCharCode(9834);
  164. herz[i].style.fontWeight='bold';
  165. herzy[i]=false;
  166. for (t=herzs[i]; t<=maxisize; t++) setTimeout('herz['+i+'].style.fontSize="'+t+'px"', 60*(t-herzs[i]));
  167. setTimeout('herz['+i+'].style.visibility="hidden";', 60*(t-herzs[i]));
  168. }
  169.  
  170. document.onmousemove=mouse;
  171. function mouse(e) {
  172. if (e) {
  173. y=e.pageY;
  174. x=e.pageX;
  175. }
  176. else {
  177. set_scroll();
  178. y=event.y+sdown;
  179. x=event.x+sleft;
  180. }
  181. }
  182.  
  183. window.onresize=set_width;
  184. function set_width() {
  185. var sw_min=999999;
  186. var sh_min=999999;
  187. if (document.documentElement && document.documentElement.clientWidth) {
  188. if (document.documentElement.clientWidth>0) sw_min=document.documentElement.clientWidth;
  189. if (document.documentElement.clientHeight>0) sh_min=document.documentElement.clientHeight;
  190. }
  191. if (typeof(self.innerWidth)=='number' && self.innerWidth) {
  192. if (self.innerWidth>0 && self.innerWidth<sw_min) sw_min=self.innerWidth;
  193. if (self.innerHeight>0 && self.innerHeight<sh_min) sh_min=self.innerHeight;
  194. }
  195. if (document.body.clientWidth) {
  196. if (document.body.clientWidth>0 && document.body.clientWidth<sw_min) sw_min=document.body.clientWidth;
  197. if (document.body.clientHeight>0 && document.body.clientHeight<sh_min) sh_min=document.body.clientHeight;
  198. }
  199. if (sw_min==999999 || sh_min==999999) {
  200. sw_min=800;
  201. sh_min=600;
  202. }
  203. swide=sw_min;
  204. shigh=sh_min;
  205. }
  206.  
  207. window.onscroll=set_scroll;
  208. function set_scroll() {
  209. if (typeof(self.pageYOffset)=='number') {
  210. sdown=self.pageYOffset;
  211. sleft=self.pageXOffset;
  212. }
  213. else if (document.body && (document.body.scrollTop || document.body.scrollLeft)) {
  214. sdown=document.body.scrollTop;
  215. sleft=document.body.scrollLeft;
  216. }
  217. else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
  218. sleft=document.documentElement.scrollLeft;
  219. sdown=document.documentElement.scrollTop;
  220. }
  221. else {
  222. sdown=0;
  223. sleft=0;
  224. }
  225. }
  226.  
  227. function createDiv(height, width) {
  228. var div=document.createElement("div");
  229. div.style.position="absolute";
  230. div.style.height=height;
  231. div.style.width=width;
  232. div.style.overflow="hidden";
  233. div.style.backgroundColor="transparent";
  234. return (div);
  235. }
  236. // ]]>
  237. </script>
Advertisement
Add Comment
Please, Sign In to add comment