--[[ This function loads an image and in the meanwhile it fades the old loaded image out. When loading this image, it will fade in. Argument one: Image object, must be a string and ofcourse of type OBJECT_IMAGE Argument two: Image File, Must exist, be string and an image file Argument Three: Maximum opacity, must be a number above Minimum opacity (0+) and below 100 OPTIONAL (Default: 100) Argument Four: Minimum opacity, must be a number lower then Maximum opacity (100-) and above 0 OPTIONAL (Default: 0) Argument Five: Timout, The time out in miliseconds between every opacity change. OPTIONAL (Default: 10) Argument Siz: Function in between, You can parse a function that will be executed between fading out and fading in the image. OPTIONAL ]] function Image.LoadFadeImage(sImageObject, imagefile, Max, Min, timeout, fInBetween) local function sleep(n) Application.Sleep(n);end if(type(timeout)~="number")then timeout=nil;end if(type(Max)~="number")or(Max<0)or(Max>100)then Max=100;end if(type(Min)~="number")or(Min<0)or(Min>100)then Min=0;end if(not File.DoesExist(imagefile))then error("Error, File does not exist!",2);return -1;end if(type(sImageObject)~="string")then error("Error, Object must be parsed as string!",2);return -1;end while(Image.GetOpacity(sImageObject) > Min)do Image.SetOpacity(sImageObject, Image.GetOpacity(sImageObject)-1) sleep(timeout or 10); end if(type(fInBetween)=="function")then fInBetween(); end Image.Load(sImageObject, imagefile); while(Image.GetOpacity(sImageObject) < Max)do Image.SetOpacity(sImageObject, Image.GetOpacity(sImageObject)+1) sleep(timeout or 10); end end --[[ This function fades in an image object. Argument one: Image Object, Must be of type OBJECT_IMAGE and must be parsed as string. Argument two: Maximum Opacity, Must be of type number and lower than 100, higher than 0. OPTIONAL (Default: 100) Argument three: Timeout, The timeout in miliseconds between every opacity change. OPTIONAL (Default: 10) ]] function Image.FadeIn(sImageObject, Max, timeout) if(type(Max)~="number")then Max=100;end if(Max<0)or(Max>100)then Max=100;end if(type(timeout)~="number")then timeout=10;end if(type(sImageObject)~="string")then error("Error, Object must be parsed as string!",2);return false;end if(Image.GetOpacity(sImageObject)>=Max)then return true;end while(Image.GetOpacity(sImageObject) < Max)do Image.SetOpacity(sImageObject, Image.GetOpacity(sImageObject)+1) Application.Sleep(timeout); end return true; end --[[ This function fades out an image object. Argument one: Image Object, Must be of type OBJECT_IMAGE and must be parsed as string. Argument two: Minimum Opacity, Must be of type number and higher than 0, lower than 100. OPTIONAL (Default: 100) Argument three: Timeout, The timeout in miliseconds between every opacity change. OPTIONAL (Default: 10) ]] function Image.FadeOut(sImageObject, Min, timeout) if(type(Min)~="number")then Min=100;end if(Min<0)or(Min>100)then Min=100;end if(type(timeout)~="number")then timeout=10;end if(type(sImageObject)~="string")then error("Error, Object must be parsed as string!",2);return false;end if(Image.GetOpacity(sImageObject)<=Min)then return true;end while(Image.GetOpacity(sImageObject) > Min)do Image.SetOpacity(sImageObject, Image.GetOpacity(sImageObject)-1) Application.Sleep(timeout); end return true; end