Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #2463
| From | Markus Triska <triska@metalevel.at> |
|---|---|
| Newsgroups | comp.lang.postscript |
| Subject | Re: Animations in PostScript |
| Organization | man |
| References | <m260wjipxs.fsf@metalevel.at> <ncrh6t$5lr$1@dont-email.me> |
| Message-ID | <m27fgu5p38.fsf@metalevel.at> (permalink) |
| Date | 2016-03-22 19:45 +0100 |
Hi Carlos,
Carlos <angus@quovadis.com.ar> writes:
> I think I don't get it. What you mean with "creating a portable
> animation" is just watching Ghostscript paint the page until it is
> complete, isn't it?
The key idea is to use GhostScript so that it shows the animation in
real-time, i.e., while the search is still ongoing and not yet
completed. In the way described on the page, GhostScript's interactive
execution mode is used so that emitted PostScript instructions are
processed as soon as they are received.
Let us have a look at the PostScript instructions of the N-queens
example I linked to. If you use the following Prolog query, the
PostScript instructions for placing and removing queens are emitted on
standard output:
?- n_queens(8, Qs), animate(Qs), label(Qs).
1 8 i
1 7 i
1 6 i
1 5 i
1 4 i
1 3 i
1 2 i
1 1 q
8 8 i
...
etc.
The point is that you can directly pipe these instructions to
GhostScript, and this way obtain a real-time animation of the actual
search process while it is still ongoing. The only prerequisite in this
case are a few simple definitions for the procedures q, c, etc. which
are used in this example to place a queen (q) and clear (c) a field.
This works because GhostScript uses an implicit "flushpage" after each
newline, so that the result is guaranteed to show up on screen. If that
were not the case, you can obtain the same effect by setting the
language level to 2 and using "copypage" yourself in the output.
> I thought you meant how to create a .gif/.gifv file (an easier way
> than a frame per page), or that javascript animation you put on the
> page...
The JavaScript animation was obtained in this case by converting the
resulting PostScript instructions of a completed animation. In the
PostScript example though, the key advantage is that we can show the
process dynamically while it is still ongoing, using the actual
search process as the direct source of the animation.
This is tremendously helpful in more complex situations: In the simpler
N-queens examples, we have the luxury to first run the search to
completion, and then view the output at once. But this is only the case
in a tiny minority of real-world use cases of such search tasks!
Typically, you start a search and have no idea what is happening. To see
what is happening, you can emit output on the terminal (ugly, slow etc.)
or use some GUI toolkit (complex, often non-portable etc.). Or, and that
is what I am showing on the page, you can simply emit PostScript
instructions and pipe them to GhostScript for excellent and portable
typesetting quality, obtaining colours and scalable output for free.
I hope this helps. Thank you for your interest in this!
All the best,
Markus
Back to comp.lang.postscript | Previous | Next — Previous in thread | Find similar | Unroll thread
Animations in PostScript Markus Triska <triska@metalevel.at> - 2016-03-18 19:47 +0100
Re: Animations in PostScript tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2016-03-20 14:31 -0400
Re: Animations in PostScript Markus Triska <triska@metalevel.at> - 2016-03-21 21:22 +0100
Re: Animations in PostScript Carlos <angus@quovadis.com.ar> - 2016-03-22 14:30 +0100
Re: Animations in PostScript Markus Triska <triska@metalevel.at> - 2016-03-22 19:45 +0100
csiph-web