Page 1 of 2
Epicyclic doodles
Posted: Thu Jan 07, 2021 10:05 am
by stevepoole
Hi Folks,
As part of my JavaScript learning curve, I dug out an old SuperBasic doodle to transcode.
Just LRUN and watch the QL _bas version, or unzip and click on the .html file on your PC.
In SuperBasic, PAUSEs allow the graphics to be seen, but in JavaScript there is no keyword equivalent....
So I put in a delay loop and alert() to stall output, which works ok under Firefox, (but not in Chrome).
But no joy on tablets or smartphones either, as the alert 'popup' window covers the screen.
I posted queries about this on html web forums, but got no reply as of yet.
Without PAUSEs in JavaScript, many QL programs will not be transcodable. Any suggestions would be greatly appreciated.
(The JavaScript 'pause' function, only pauses audio/video-files, and timeouts do not stall screen output either).
Steve.
Re: Epicyclic doodles
Posted: Thu Jan 07, 2021 11:01 am
by XorA
If I understand you correctly you want to stop program for a fixed amount of time?
https://www.tutorialspoint.com/javascri ... p-function
Re: Epicyclic doodles
Posted: Thu Jan 07, 2021 9:42 pm
by stevepoole
Hi Xora,
Many thanks indded for the information.
I have tried out the proposed code, but think I need to study it a bit more, as there are some new concepts to me, such as asynchronous functions.
But from my first attempts, it would appear that the code uses timeouts, which do delay function calls, but which do not update the screen graphics.
I will report back after some more experiments, as soon as I get a bit of free time.
It would be strange if there was no simple solution to the problem of pausing graphics output !
Regards,
Steve.
Re: Epicyclic doodles
Posted: Tue Jan 12, 2021 10:57 pm
by stevepoole
Hi Folks,
After some exchanges with a JavaScript Tutorial Forum, it would appear that the language is basically intended for developers of websites. This means that such programs as those that were written for vintage computers are not really welcome, as they may represent supports for malware attacks, hacking etc.
The possibilities for 'amateur' programers would therefore appear to be limited... despite frequent appeals to encourage such programming !
Another multi-platform language is C++, which would mean using Microsofts Visual Studio interface....
How lucky we were in the '80s to be able to learn and use our vintage computers more or less as we wished... for work or play !
It would seem that the more people get access to smartphones, the less possibility there is to be able self-program them.
Yet the real danger is more HOW people use them even as they stand .... even with commercial software !
Luckily we still have our QLs to Tinker with until covid will eventually be dominated...
Steve.
Re: Epicyclic doodles
Posted: Sun Jan 17, 2021 1:03 pm
by stevepoole
Hi,
Finally, there IS an undocumented way of implementing PAUSES in JavaScript :
First open a new tiny window and close it again immediately. This forces pending graphics to be drawn on the main screen beforehand !
Then, call a dud FOR loop to waste some time... the 'pause'. OK on FireFox, but Chrome can't handle it properly.... nor IE.
So my 'epicyclic doodle' is nearly OK for tablets and smartphones. Some tweaks to my Browsers appear to be needed ?
Thereafter I should be able to start transcoding some bigger, more interesting QL programs for other devices.
The web tutorial forums are indeed helpful.
Steve.
Re: Epicyclic doodles
Posted: Mon Feb 01, 2021 5:56 am
by stevepoole
Hi,
Unfortunately, there is NO simple way of implementing the pausing of graphics in JavaScript, to run on smartphones.
Therefore, I shall not continue any further work in that language, to transcode QL programs.
This is a great pity, as I had been requested to transcode some very important software, but every time success was acheived, the system changed....
Maybe I should try again using my RASPberry Pi ? I have seen some considerable success in that field professionally.....
Regards,
Steve.
Re: Epicyclic doodles
Posted: Mon Feb 01, 2021 11:26 am
by XorA
Can you post (or link to) a snippet of code, I am finding your descriptions hard to follow, but I know what I think you want to do is trivially possible in javascript!
Re: Epicyclic doodles
Posted: Mon Feb 01, 2021 11:27 am
by XorA
XorA wrote:Can you post (or link to) a snippet of code, I am finding your descriptions hard to follow, but I know what I think you want to do is trivially possible in javascript!
Note, its been about 20 years since I used to code in JS so Im very rusty!
Re: Epicyclic doodles
Posted: Tue Feb 02, 2021 6:06 am
by stevepoole
Hi Xora,
I gave the problem code in my JAN 07 10.05am posting : It is a PC.zip file, both the QL _bas and PC Javascript programs.
I execute the JavaScript from NotePad++, where it runs OK under FireFox, ( but not under Chrome ! ).
If you run the epicycle_bas program, you will see why PAUSEs are necessary for the animated output.
The epicycle2 (html) code is written with calls to a FOR loop & popup to slug the program, on lines 93 & 95. (flashit, waits and cls).
JavaScript does have a pause() function to pause videos, but apart from lines 93 & 95, I cannot pause html....
If you know of any way to acheive basic-style PAUSE, I would be very grateful.
This epicycles program is just being used to try to see how PAUSE can be implemented. Later I hoped to transcode a very big important program for smartphones which has been requested by an international computing expert at Tel Aviv university.... which needs Pauses too ! ( It works fine in C++ ).
Best Regards,
Steve.
Re: Epicyclic doodles
Posted: Tue Feb 02, 2021 10:51 am
by XorA
Ah I totally missed the attachment, I’ll take a look.