示例#1
0
  function startTracking(e) {
    e.preventDefault();
    if (active) active.stop();

    active = pointer()
      .pipe(
        (v) => {
          const nodePos = node.getBoundingClientRect();
          const nodeCenter = {
            x: nodePos.left + (nodePos.width / 2),
            y: nodePos.top + (nodePos.height / 2)
          };
          const angleFromCenter = angle(nodeCenter, v);

          return angleFromCenter;
        },
        applyOffset(nodeRotation.get())
      )
      .start(nodeRotation);
  }
示例#2
0
 .start((e) => {
   e.preventDefault();
   pointer(ballXY.get()).start(ballXY);
 });