I recently created a simulation of robotic arm movement
https://www.youtube.com/watch?v=Qs-W6Lzi1XQ using pas2js technology. I was not using the latest version of pas2js but a slightly older one, from 2020 year. There is no library support implemented there yet, which is probably already in the newer version. In general, most of the code concerning math and arm movement comes from my earlier work, but it was new experience for me the use of possibilities concerning graphics that pas2js gives. However during programming the surprise was how to read a local file (text file) which contains a set of vectors that form the movement path for the arm. To read such files I did the following (Windows 7):
- I installed the XAMPP server
- in the XAMPP\htdocs directory, I created a .htacces file
- the content of this file is the entry: Header set Access-Control-Allow-Origin "*".
- in the directory XAMPP\htdocs I created my directory where I keep my files, so then it looks like C:\XAMPP\htdocs\mydir
- Restart the XAMPP server
These steps helped me to avoid the CORS error that the browser reports when trying to open a file from a local disk. If you know better methods to open and read local text files I will be glad to know.