Code
var path = new Path({
segments: [
[20, 20],
[80, 80],
[140, 20]
],
strokeColor: 'red',
strokeWidth: 20,
strokeCap: 'round',
selected: false,
position: view.center,
});
function onMouseMove(event) {
path.add(event.point - event.delta / 2);
path.smooth(5);
path.segments[0].remove();
if (path.contains(event.point)) {
isFoundObject = true;
} else {
isFoundObject = false;
}
}
function onFrame(event) {
path.strokeWidth = (24 + Math.cos((event.count * 20) *
(Math.PI / 180)));
path.opacity = 0.9 + event.count % 5;
}