Jump to content

Pausing graphics ?


Recommended Posts

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?

 

 

Link to post
Share on other sites
  • 2 weeks later...

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.      

 

 

Link to post
Share on other sites

Please post your code using the code tags.  Preferably, only the relevant parts.

Link to post
Share on other sites

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

Link to post
Share on other sites
 

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.

 

 

 

Link to post
Share on other sites

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 by niche
Link to post
Share on other sites

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. 

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...