我无法理解 Leader-Line js 文档

发布于 2025-01-09 04:36:20 字数 955 浏览 0 评论 0原文

我正在尝试创建使用引线库从 a 点到 b 点绘制一条线的代码。 https://github.com/anseki/leader-line

它看起来像我需要的部分引用位于方法下

self = line.show([showEffectName[, animOptions]])

,其中 showEffectName: 'draw'animOptions: {duration: 500, Timing: [0.58, 0, 0.42, 1]}

这是一个使用按钮显示/隐藏行的示例

var line = new LeaderLine(startElement, endElement, {hide: true});
showButton.addEventListener('click', function() { line.show(); }, false);
hideButton.addEventListener('click', function() { line.hide(); }, false);

如何在按钮中实现 self= 代码?我什至不确定 self= 是什么意思。下面的代码不起作用

var line = new LeaderLine(startElement, endElement, {hide: true});
line.show() = line.show({showEffectName:'draw'}, {animOptions: {duration: 3000, timing: 'linear'}});
startElement.addEventListener('click', function() { line.show(); });

I am trying to create code that will draw a line from point a to point b using the leaderline library. https://github.com/anseki/leader-line

It looks like the section I need to reference is under Methods

self = line.show([showEffectName[, animOptions]])

where showEffectName: 'draw' and animOptions: {duration: 500, timing: [0.58, 0, 0.42, 1]}

Here is an example shown using a button to show/hide the line

var line = new LeaderLine(startElement, endElement, {hide: true});
showButton.addEventListener('click', function() { line.show(); }, false);
hideButton.addEventListener('click', function() { line.hide(); }, false);

How do I implement the self= code into the button? I'm not even sure what self= is supposed to mean. The below code does not work

var line = new LeaderLine(startElement, endElement, {hide: true});
line.show() = line.show({showEffectName:'draw'}, {animOptions: {duration: 3000, timing: 'linear'}});
startElement.addEventListener('click', function() { line.show(); });

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

天涯沦落人 2025-01-16 04:36:20

这就是您正在寻找的东西

line.show('draw', {
  animOptions: {
    duration: 3000,
    timing: [0.5, 0, 1, 0.42]
  }
})

现在你可以在任何函数中调用它

button.addEventListener('click', function() {
  line.show('draw', {
    animOptions: {
      duration: 3000,
      timing: [0.5, 0, 1, 0.42]
    }
  })
});

Here is what you are looking for

line.show('draw', {
  animOptions: {
    duration: 3000,
    timing: [0.5, 0, 1, 0.42]
  }
})

And now you can call this in any function

button.addEventListener('click', function() {
  line.show('draw', {
    animOptions: {
      duration: 3000,
      timing: [0.5, 0, 1, 0.42]
    }
  })
});

一抹苦笑 2025-01-16 04:36:20

您的代码不起作用,因为您必须只输入如下所示的值。

var line = new LeaderLine(startElement, endElement, {hide: true});

startElement.addEventListener("click", function () {
  line.show("draw", {duration: 3000, timing: 'linear'});
});

Your code does not work because you have to put only value like below.

var line = new LeaderLine(startElement, endElement, {hide: true});

startElement.addEventListener("click", function () {
  line.show("draw", {duration: 3000, timing: 'linear'});
});
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文