【问题标题】:Circle Follow Cursor圆圈跟随光标
【发布时间】:2021-07-10 05:58:27
【问题描述】:

您好,我访问了一个网站 ([myuu.xyz][]),该网站在鼠标动画之后有一个很酷的圆圈。我在 JS 和 CSS 中发现了一些东西([js:

jQuery(document).ready(function() {

  var mouseX = 0, mouseY = 0;
  var xp = 0, yp = 0;
   
  $(document).mousemove(function(e){
    mouseX = e.pageX - 30;
    mouseY = e.pageY - 30; 
  });
    
  setInterval(function(){
    xp += ((mouseX - xp)/6);
    yp += ((mouseY - yp)/6);
    $("#circle").css({left: xp +'px', top: yp +'px'});
  }, 20);

});]

2 , and stackoverflow) 但我想在 Python 中使用烧瓶做同样的事情。这可能吗?

【问题讨论】:

标签: html python-3.x flask


【解决方案1】:

这是@charchit 的日志

Uncaught TypeError: h is null
    onmousemove https://pyjokes-web.yoplayer1py.repl.co/bTest:14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove https://pyjokes-web.yoplayer1py.repl.co/bTest:14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove https://pyjokes-web.yoplayer1py.repl.co/bTest:14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove https://pyjokes-web.yoplayer1py.repl.co/bTest:14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove https://pyjokes-web.yoplayer1py.repl.co/bTest:14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove https://pyjokes-web.yoplayer1py.repl.co/bTest:14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove https://pyjokes-web.yoplayer1py.repl.co/bTest:14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14
bTest:14:3

Uncaught TypeError: h is null
    onmousemove (the link bcause of reputation err I can't post):14
bTest:14:3

是的,它会循环。


【讨论】:

  • 如果你想让一个圆圈跟随你的鼠标在网站周围。你能通过我的不和谐charchit#8198联系我吗?这不是一个循环,它是一个事件并在鼠标移动时触发。我不知道什么是 h 以及为什么它是 null ,
  • h 是一个变量。 var h =document.querySelector('.cursor'); document.body.onmousemove = function(e) { /* 15 = background-size/2 */ h.style.setProperty('background-position',(e.clientX - 15)+'px '+(e.clientY - 15)+'px'); }
  • 我希望它跟随在按钮中(暂时。我稍后会制作一个网站。)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-05-21
  • 2018-03-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-04
  • 2021-01-15
相关资源
最近更新 更多