简体   繁体   中英

Repeat mouse path with different start and end points

I have recorded mouse path stored as array.

record: function(selector) {
    var target = document.querySelector(selector);
    this.target = target;
    target.addEventListener('mousemove', (event) => {
        if (!event.isTrusted)
            return false;

        var x = event.pageX - target.offsetLeft;
        var y = event.pageY - target.offsetTop;

        this.addPoint(x, y);
    });
}

How can I repeat recorded path with other start and stop coordinates? Could someone provide code example or library?

For example:

[0, 1] [0, 2] [0, 3] [0, 4]

Start point is [0, 1] and end point [0, 4]. I want to repeat the same path but with different start and stop points.

关于“有人可以提供代码示例或库吗?”,请看一下Paper.js( http://paperjs.org/features/#vector-geometry )及其关于矢量几何的教程( https:// scriptographer。 org / tutorials / geometry / vector-geometry )。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM