Active4 years, 1 month ago
The Web Animations API lets us construct animations and control their playback with JavaScript. This article will start you off in the right. Paper.js is a JavaScript library for drawings and animations. You can also change the code by clicking the “Edit” button, see your changes.
What iam trying to do, is this:
- click somewhere (get position of click)
- tell to path 'go to the clicked spot'
- path is moving smoothly via animate to clicked location
so far i have this code:
working jsfiddle
current code is obviously wrong. The path is always going bottom right and there are other problems. I guess that what i could use is something like this:
But iam having problems to understand how it works.
MeviaMevia
1 Answer
You have to edit the following lines to this:
Here is your changed jsfiddle. If you want to understand what I did and how to improve your code maybe try to read a bit about vector geometry on the paperjs website.
ChristophChristoph