V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lanhaooclub
V2EX  ›  分享发现

试试画一个完美的圆

  •  
  •   lanhaooclub · 2020-06-07 20:42:10 +08:00 · 2670 次点击
    这是一个创建于 1635 天前的主题,其中的信息可能已经有所发展或是发生改变。

    网上看见的这个网站, 画一个完美的圆

    https://vole.wtf/perfect-circle/

    然后主页上也有一些神奇的东西。。。。🤦‍

    第 1 条附言  ·  2020-06-07 21:40:30 +08:00
    还有一个🤦‍🤦‍🤦‍

    把球踢回给他们。。

    https://vole.wtf/kick-the-ball-back/
    13 条回复    2020-06-08 00:16:23 +08:00
    winterbells
        1
    winterbells  
       2020-06-07 20:52:29 +08:00
    93.8%最高 哈哈哈哈哈
    dandycheung
        2
    dandycheung  
       2020-06-07 21:05:19 +08:00 via iPhone
    94.6
    ob
        3
    ob  
       2020-06-07 21:07:19 +08:00 via Android
    96.5
    Ultraman
        4
    Ultraman  
       2020-06-07 21:09:25 +08:00 via Android
    还触发个类似彩蛋的玩意儿
    https://i.loli.net/2020/06/07/C1OGnb3dcqIWLYM.jpg
    systemcall
        5
    systemcall  
       2020-06-07 21:22:28 +08:00
    96.8
    小学的时候,信息课考试考过拿鼠标画圆
    lanhaooclub
        6
    lanhaooclub  
    OP
       2020-06-07 21:28:05 +08:00
    @Ultraman 哈哈哈哈哈 uncontrollable urge 哈哈哈哈哈
    godonlyknows
        7
    godonlyknows  
       2020-06-07 21:28:54 +08:00 via Android
    97.6
    IzayakI
        8
    IzayakI  
       2020-06-07 21:30:39 +08:00
    @Ultraman 这是广告,让你关注他推特啥的
    IzayakI
        9
    IzayakI  
       2020-06-07 21:34:54 +08:00
    92.9
    Ultraman
        10
    Ultraman  
       2020-06-07 21:56:09 +08:00
    @IzayakI #8 我知道,但是这个文案还有视觉效果挺有意思的.
    miaeLKK
        11
    miaeLKK  
       2020-06-07 22:02:53 +08:00 via Android
    分高的都是杨二嫂,对,就我笔下的那个,哈哈
    rabbbit
        12
    rabbbit  
       2020-06-07 22:56:20 +08:00   ❤️ 5
    尽梨了,谁能告诉我剩下的那 0.2 差在哪?



    ```
    function sleep(time = 100) {
      return new Promise((reslove) => {
       setTimeout(() => {
        reslove();
      }, time)
     })
    }

    async function drawCircleByMouse(canvasEl, centerX, centerY, radius = 200) {
      let radian = 0;
      const pointers = [];

      while (radian < Math.PI * 2) {
       const x = centerX + Math.cos(radian) * radius
       const y = centerY + Math.sin(radian) * radius
       pointers.push({ x, y });
       radian += 0.1;
     }

      const startPoint = pointers[0];
      const mousedownEnt = new MouseEvent("mousedown", { clientX: startPoint.x, clientY: startPoint.y, bubbles: true });
      canvasEl.dispatchEvent(mousedownEnt);

      for (let point of pointers) {
       await sleep();
       const mousemoveEnt = new MouseEvent("mousemove", { clientX: point.x, clientY: point.y, bubbles: true });
       canvasEl.dispatchEvent(mousemoveEnt);
       radian += 0.01;
     }

      const mousemoveEnt = new MouseEvent("mousemove", { clientX: startPoint.x, clientY: startPoint.y, bubbles: true });
      canvasEl.dispatchEvent(mousemoveEnt);

      const endPoint = pointers[pointers.length - 1];
      const mouseupEnt = new MouseEvent("mouseup", { clientX: endPoint.x, clientY: endPoint.y, bubbles: true });
      canvasEl.dispatchEvent(mouseupEnt);
    }

    document.querySelector('a').click();
    setTimeout(async () => {
      const el = document.querySelector('div');
      const rect = el.getBoundingClientRect();
      const rem = window.innerHeight / 100 * 9;
      const centerX = window.innerWidth / 2;
      const centerY = window.innerHeight / 2 - 20;
      await drawCircleByMouse(el, centerX, centerY);
    }, 2000);
    ```
    lanhaooclub
        13
    lanhaooclub  
    OP
       2020-06-08 00:16:23 +08:00
    @rabbbit 代码很棒, 剩下的 0.2,我这边屏幕 4800*4000, 设置 radius 1200 以上就 OK
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1036 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 20:42 · PVG 04:42 · LAX 12:42 · JFK 15:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.