seaver has asked for the wisdom of the Perl Monks concerning the following question:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: interactive web graphics
by BrowserUk (Patriarch) on Sep 28, 2002 at 05:19 UTC | |
It kind of depends quite what you mean by "move around the screen". If you need for the user to be able to interact with the graphics, and drag them around with the mouse, in the browser, then you almost certainly will need to use Java or perhaps Flash. I recently saw some impressive work done by baz with SVG which had the ability to allow the user to click in areas of the graphic and have Javascript detect, highlight the clicked part (similar to image maps) and take action as a result, but from the little I know about SVG, I'm not sure that you could do anything very dynamic with it. I am quite open to being wrong on that. If however, you are more interested in the graphic itself having motion, as in some biochemical applications where molecules and proteins are rotated in pseudo-3D, so that their shape and structure are visible, then this is something that you could do with Perl at the server side using GD and or TK to generate animated gifs. The results can be quite impressive. I've posted a simple example of what I mean on my home node. I tried to create a link to it standalone, but the magic of the Everything engine denied me. I'll leave it around for a few days. This actually consists of a single graphic character rendered in 3D with highlighting and shadows at 320x200x4bit(16 colours) with 15 frames displaying at 10 frames/sec for a total filesize of just on 60k. I had to keep it small and light as the limit for homepage images is 80k and I don't have any where else to put stuff right now. The color isn't great, but its fairly impressive given the small size of the file I think. It was rendered using a using a commercial package (which I'll plug cos they produce several, brillantly fast, bloat-free and cheap (windows) graphics editor applications. No connections kick backs etc. This one was Xara3dv4. They have recently released v5 which can export into .swf format as well. Well worth a browse of their site to see their demo's and other apps.) Anyway, commercial break over, back to the Perl connection. Perl can render GIF format files quite quickly, I've done this using GD for graphs, and a quick look at Tk::Animation shows that it can handle multi-framed GIF's including the ability to build them on the fly. I didn't see the save facility in my breif look, but I'd be surprised if it wasn't there. The upshot is, So, if your timescales aren't to tight, the budget and skills are available, and your users have sufficiently high speed links to carry the volumes of data, then it would be perfectly feasible to render and display animated (and possibly, with judicious use of client-side image mapping, even intereactive) graphical interface applications using a combination of Perl, CGI.pm and Perl/Tk. Whether this is a desirable, and/or cost effective means of achieving your goal very much depends on the scale and detail of your application. Good luck. If you go ahead and produce something that is publicly visible, I would love to see the results as I've a long history of doing strange thngs with graphics. BTW, I appreciate that the GIF format is deprecated currently due to the on-going legal rows, but I haven't seen any examples of non-commercial usages being targeted yet. Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring! | [reply] |
by seaver (Pilgrim) on Sep 30, 2002 at 14:08 UTC | |
| [reply] |
by BrowserUk (Patriarch) on Sep 30, 2002 at 14:43 UTC | |
Glad you liked it. Now to ruin it all by suggesting a non-perl solution:) Have you looked at the power and ease of the (free I believe, but don't quote me), MDL Chime application designed from the ground up for doing exactly this type of thing, and with its own command language. It runs as a plug-in to either Netscape or IE and runs under Windows or Mac. They also have an older version of the application with a command line interface rather than a GUI interface that runs under Linux. The ouput from this can be used to drive the Chime application from what I understand. Since writing my original response, I have had a go at doing something along the lines I described and have encountered difficulties with using Tk::Animation myself. Specifically, on my system using my near verbatim copy of a peice of sample code I found kicking around the web, my attempts to load even a simple GIF, a 6k static or a 14k 2 page animation causes Tk to expand to fill all of my available memory (over 200MB!) and then start to swap whilst chewing 100% of my cpu. I have yet to resolve this problem. In terms of your latest question, I think it would be possible to use multiple layers of GIF's with transparent backgrounds as overlays, and JS buttons and a bit of dynamicHTML or Stylesheet attributes to turn the overlays on and off (show/hide usng visibilty attributes?), but I think that making this run quickly enough to have a reasonable response time as a Server-driven web app would be very difficult indeed. AS I said before, if you just want the protiens to rotate or zoom, that's quite easy, but dragging and dropping on the client with a server driven app would be pushing you luck I think. Maybe when Perl6 arrives we will see a PerlVirtualMachine plug-in written and it might become viable then, but in the meantime, I think that Java is your way forward as its here now and works. Now if only there was a Perl to Java Byte-code complier, but I guess thats just too fanciful :^) I think I would, unless you have extremely good reasons not to, take a long, hard look at MDL Chime, and even if there is some cost involved--I'm sure the plugin is free, but there maybe other components that you would need to purchase. Unless it is hugely expensive, you could probably trade that against the substantial costs of developing such an application in-house. Good luck, and if your able, keep me informed of your progress, this type of app is a personal favourite of mine.
Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring! | [reply] [d/l] |
by seaver (Pilgrim) on Sep 30, 2002 at 15:06 UTC | |
|
Re: interactive web graphics
by fsn (Friar) on Sep 27, 2002 at 21:39 UTC | |
Another way of doing it would be with SWF. Then you could, possibly, use swf modules to generate the molecule viewer on the fly, probably from some template SWF file. The hard part of this really isn't the Perl parts. The hard part is the molecule viewer itself. Find it, and the rest will fall into place... | [reply] |
|
Re: interactive web graphics
by fglock (Vicar) on Sep 28, 2002 at 04:42 UTC | |
| [reply] | |