- Home /
Question by
madskillzHD · Mar 02, 2015 at 04:15 PM ·
javascriptsimpleflipfast
Fliping The Code Backwards?
See this is the script I got and when enabled it fades in, if someone could flip it to fade out or even show me I would be very grateful. Here is the code, its in java in case you were wondering. -
#pragma strict
// FadeInOut
var fadeTexture : Texture2D;
var fadeSpeed = 0.2;
var drawDepth = -1000;
private var alpha = 1.0;
private var fadeDir = -1;
function OnGUI(){
alpha += fadeDir * fadeSpeed * Time.deltaTime;
alpha = Mathf.Clamp01(alpha);
GUI.color.a = alpha;
GUI.depth = drawDepth;
GUI.DrawTexture(Rect(0, 0, Screen.width, Screen.height), fadeTexture);
}
Comment
Best Answer
Answer by NoseKills · Mar 02, 2015 at 04:16 PM
Change fadeDir
from positive to negative to change the fade direction.
Your answer
Follow this Question
Related Questions
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Help with Functions 3 Answers
How to switch off two lights? 2 Answers
car movement basics 5 Answers
Simple Animation for Unity3d 1 Answer