dcsimg
A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: Raindrop effect?

Hybrid View

  1. #1
    Senior Member
    Join Date
    Mar 2002
    Posts
    100

    Raindrop effect?

    Hey, I'm currently working on a little flash movie. I'm trying to get a good looking rain effect.

    What I did, was use the paint tool to create 1 solid paint image, with little greyish lines going across the screen. It will be animated, flowing down on a angle. However when I do this, the program becomes choppy, even when I view it on IE.

    Is there a way to fix this? Or another way to make a good looking rain effect without all the choppy-ness?

  2. #2
    Senior Member FLASHPULSE's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    1,335
    hmmm.... that's weird. how did you go about as in animating the rain? this might help for someone to reply with an answer for you.

  3. #3
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    Re: Raindrop effect?

    Originally posted by Wheeljack
    Is there a way to fix this? Or another way to make a good looking rain effect without all the choppy-ness?
    Hard to say without seeing what you did.

  4. #4
    Member
    Join Date
    Aug 2002
    Location
    Switzerland
    Posts
    71
    i have done before a raindrop-effect.
    i took two images with raindrops and gave little opacity and a directionsspeed with tiles.
    ah, perhaps i find the example. i'm not at home now.

    had only one prob: it need a lot of cpu power if you need it for the whole screen.
    perhapts there is a javascript solution, they are cheaper.
    Bruno

    www.tonetube.ch

  5. #5
    Senior Member
    Join Date
    Mar 2002
    Posts
    100
    Yes, I tried using the ocpacity, and the tile effect so it'll move downward on a angle. But it caused the whole movie to slow down dramatically. This seems to be a big problem with 3DFA, considering I have 512mb of ram.

  6. #6
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    Did you guys try making one raindrop and using clones and javasccript?

    look at the snow example on http://deadyeti.com/blanius/snow.html

  7. #7
    Senior Member
    Join Date
    Mar 2002
    Posts
    100
    It figures, I suck at Javascript.

  8. #8
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244

    javascript code

    the javascript for this isn't too bad.....
    Make a simple raindrop paint element. Keep it simple

    Name it drop

    In the first scene put a javascript action as follows:
    PHP Code:
    width=460//Make width the width of  your movie
    height=320;//Same for height
    drop=element("drop");
    drops= new Array();//The array of rain drops Empty for now

    for (x=0;x<100;x++){//This weird little line starts a loop and increments x ever time until x is no longer less than 100
    drops[x]=drop.clone();//put a clone of the drop into the array
       
    drops[x].position.y=-10;//move it above the top of the movie
       
    drops[x].positionx=random(width);//randomly place the drop left to right
      
    drops[x].velocity.y=-random(30)+10//the +10 is to make sure it is not zero, see my randomrange function for better solution
      
    drops[x].show();//make sure it's showing

    I set the Y velocity to negative I think thats right. Not at home can't check. remove the - if it's not.

    Now create a list of actions with a javascript element:
    PHP Code:

    for (x=0;x<100;x++){
       if (
    drops[x].position.y>height){//did it go off the bottom of the screen?
         
    drops[x].position.y=-random(10);
         
    drops[x].position.x=random(width);

    This bit just checks each drop and if it's off the screen bottom puts it between 0 and 10 pixels above the screen, and randomly placed left to right.

    That should do it. This code is TOTALY untested here as I'm out of town and on a borrowed computer and cannot test any of the above. Sometimes I forget if negative y velocity is up or down.

    Any questions?

  9. #9
    Member
    Join Date
    Aug 2002
    Location
    Switzerland
    Posts
    71
    thanks for your help.
    i work on it now, the code works well.
    cu
    Bruno

    www.tonetube.ch

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center