Epicyclic doodles

Anything QL Software or Programming Related.
stevepoole
Super Gold Card
Posts: 714
Joined: Mon Nov 24, 2014 2:03 pm

Epicyclic doodles

Post 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.


epicycle_bas.zip
(1.01 KiB) Downloaded 80 times
epicycle2.zip
(2.09 KiB) Downloaded 95 times


User avatar
XorA
Site Admin
Posts: 1365
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Epicyclic doodles

Post 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


stevepoole
Super Gold Card
Posts: 714
Joined: Mon Nov 24, 2014 2:03 pm

Re: Epicyclic doodles

Post 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.


stevepoole
Super Gold Card
Posts: 714
Joined: Mon Nov 24, 2014 2:03 pm

Re: Epicyclic doodles

Post 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.


stevepoole
Super Gold Card
Posts: 714
Joined: Mon Nov 24, 2014 2:03 pm

Re: Epicyclic doodles

Post 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.


stevepoole
Super Gold Card
Posts: 714
Joined: Mon Nov 24, 2014 2:03 pm

Re: Epicyclic doodles

Post 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.


User avatar
XorA
Site Admin
Posts: 1365
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Epicyclic doodles

Post 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!


User avatar
XorA
Site Admin
Posts: 1365
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Epicyclic doodles

Post 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!


stevepoole
Super Gold Card
Posts: 714
Joined: Mon Nov 24, 2014 2:03 pm

Re: Epicyclic doodles

Post 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.


User avatar
XorA
Site Admin
Posts: 1365
Joined: Thu Jun 02, 2011 11:31 am
Location: Shotts, North Lanarkshire, Scotland, UK

Re: Epicyclic doodles

Post by XorA »

Ah I totally missed the attachment, I’ll take a look.


Post Reply