javascript - Repeat mouse path with different start and end points -
i have recorded mouse path stored 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 repeat recorded path other start , stop coordinates? provide code example or library?
for example:
[0, 1] [0, 2] [0, 3] [0, 4]
start point [0, 1] , end point [0, 4]. want repeat same path different start , stop points.
with regards "could provide code example or library?", take @ paper.js (http://paperjs.org/features/#vector-geometry) , tutorial on vector geometry (https://scriptographer.org/tutorials/geometry/vector-geometry).
Comments
Post a Comment