views:

473

answers:

3

I need to achieve something like this for my website: Flash Rain Effect

Is that possible to do in Javascript? I want it to be just as smooth as it is in Flash.

Another flash rain drop water effect

+1  A: 

Yes, it's possible: http://www.lab4games.net/zz85/blog/2010/03/10/rain-water-ripples-with-html-canvas-javascript-jquery/

Smoothness is something relative, and you may not be able to have the same performance as hardware-accelerated Flash. With that said, more and more browsers are starting to incorporate native hardware acceleration (Direct2D and otherwise).

David Titarenco
Awesome! Exactly what I was looking for :)
Silence of 2012
+1  A: 

You should be able to do this using a combination of JavaScript and canvas elements (HTML5).

AbeVoelker
I am building my website using Visual Web Developer 2010 (ASP.NET) will I still be able to implement HTML5 Canvas with ASP.NET?
Silence of 2012
@Sahat: Canvas is entirely client side JavaScript and HTML so it works with any server platform.
Matthew Crumley
+1  A: 

If you don't want to use the Canvas (or can't) you can do that by creating an image that looks like a rain drop, make it a PNG with alpha transparency so the non-drop parts of the rectangle don't show up. Then you create 200 or so IMGs programmatically and position them absolutely (and randomly) over your scene. Each one gets positioned, then turned visible for a few milliseconds, then turned invisible, then rinse and repeat.

For variety you can either make images of different sizes and shades so some seem in the background and some in the foreground, and vary those.

Robusto
You may be able to get away with scaling the images a bit too for variety. Experiment and see what works!
alex