QLsteve 0 Posted December 30, 2020 Report Share Posted December 30, 2020 I am just getting started in JavaScript, and am trying to convert programs written in BASIC into JavaScript. In a program to display 'arabesque' graphics, BASIC allows PAUSES between displayed sequences, each calculated within nested loops. My attempts to do this in JavaScript have failed, as FireFox will not pause except by using 'prompt' or 'alert' to show intermediate images. Chrome will not display the graphics at all in this case, as the screen is all blank. (My aim is to display arabesques on PCs, tablets or smartphones....) I have tried using setInterval and setTimeout, which will cause delays, but DO NOT show graphics as they are calculated. Does JavaScript have a capability to pause and show graphics output within nested loops? Quote Link to post Share on other sites
QLsteve 0 Posted January 8 Author Report Share Posted January 8 HI, It has been suggested that I try asynchronous functions, but I have not yet fully mastered that technique. Timeouts do pause code, but do NOT force graphics to be shown on screen as they are calculated..... Should I post my code on the forum, in as much as it works so far ? Any suggestions would be greatly appreciated. Quote Link to post Share on other sites
niche 133 Posted January 8 Report Share Posted January 8 Please post your code using the code tags. Preferably, only the relevant parts. Quote Link to post Share on other sites
QLsteve 0 Posted January 9 Author Report Share Posted January 9 Hi Niche, Thank you for replying to my plea for help. I attatch the complete file which will run on a PC under Firefox, but unfortunately not Chrome. The program was originally written in BASIC. The guts of it are in the core() function, called on line 93. I would hope to be able to implement a short pause of graphics drawing on lines 94 and 121. on lines 97-100, the alert() needs to be got rid of, as on my smartphone the popup hides the graphics.... M waits() function does pause the program, but I can find no way to pause the graphics, other than by using alert() or prompt() ! There must surely be a simple JavaScript function to pause graphics drawing ? Hope you can help, as many BASIC programs depend on graphics pauses.... (This one is just a simple program to get me started on JavaScript). epicycle2.html Quote Link to post Share on other sites
niche 133 Posted Monday at 10:25 PM Report Share Posted Monday at 10:25 PM Resend using the code tags. Edit your script down to the relevant parts if it's too long. Quote Link to post Share on other sites
QLsteve 0 Posted Tuesday at 03:57 AM Author Report Share Posted Tuesday at 03:57 AM epicycle2.html Hi Niche, Hope I have done it right this time, using the code <> symbol above. Please refer to my posting of sat 01:07 for details of the relevant section needing attention. I would be very grateful if you could advise, as this problem is totally blocking any further projects I have in mind. Many thanks for your interventions. Quote Link to post Share on other sites
niche 133 Posted Tuesday at 05:18 PM Report Share Posted Tuesday at 05:18 PM (edited) Nope. Not yet. Paste the actual text of your code using the code tags. That will make your code visible in your post. You keep posting the file. It's usually always very bad practice to click a button connected to a file from an unknown source. We want to see your work an a completely SAFE environment. Please post the text, not the file, using the <> tags. IF IT'S TOO LONG, edit out the irrelevant parts. EDIT: We need to see something with a format like this: <!DOCTYPE html> <html> <head> <style> img { float: right; } </style> </head> <body> <h1>The float Property</h1> <p>In this example, the image will float to the right in the text, and the text in the paragraph will wrap around the image.</p> <p><img src="pineapple.jpg" alt="Pineapple" style="width:170px;height:170px;margin-left:15px;"> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus imperdiet, nulla et dictum interdum.</p> </body> </html> Edited Tuesday at 05:37 PM by niche Quote Link to post Share on other sites
QLsteve 0 Posted 18 hours ago Author Report Share Posted 18 hours ago Hi Niche, << It's usually always very bad practice to click a button connected to a file from an unknown source. >> Yes, that is why I always use proprietary checking software to guard against the risk... I've neen exchanging files frequently since the '80s, and never seen a hint of a virus yet... Best Regards, QL Steve. Quote Link to post Share on other sites
niche 133 Posted 17 hours ago Report Share Posted 17 hours ago Read the Guidelines. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.