2D Smooth Fade by Richard Davey12th Sep 2003 13:03
|
---|
Summary A smooth screen fade routine (fade to black and fade from black to image) that works in 2D! With no 3D switching required. Coded in response to a plea in the DarkBasic forum and to Description ========================================================== Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ` Smooth 2D Screen Fade ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ` By Rich Davey (rich@fatal-design.com) ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ` Music listened to while coding this ` Euphoria Level 4 (CD2) ` -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ` Note: ` ` Coded in response to a plea in the DB ` forum, doesn't need 3D switching!!! sync rate 0 sync on hide mouse center text 320,240,"Please Wait..." ` Change this BMP for any 640x480 bitmap load bitmap "fadepic2.bmp",1 ` s=the delay between each fade frame (30=slow, 10=fast) ` Change the step minus value to control the total number of frames. ` The higher the value, the faster the initial calculation. ` Good value is -10 or -5. (10=faster, 5=smoother) ` Be advised the more frames the more memory taken up! i=1 : s=25 for a=100 to 0 step -5 get image i,0,0,640,480 fade bitmap 1,a inc i next a set current bitmap 0 ` Fade it... in and then out, ad infinitum do for a=i-1 to 1 step -1 paste image a,0,0 sleep s sync next a sleep 4000 for a=1 to i-1 paste image a,0,0 sleep s sync next a loop |