Overkillz Posted September 5, 2014 Share Posted September 5, 2014 Hey everone, I hope u are ok, Always I must say this due to this community always help me Well, about my question, I will like to know if is possible add a fade effet -appear and dessapear 0,5 seconds to fade appear 1 seconds appear 0,5 seconds fade dissapear/out local tagColor = rgbToHex(r,g,b) or "#FFFFFF" dxDrawColorText("#ffffffWinner: "..tagColor..getPlayerName(winnerD).." #ffffff!", screenWidth/2, screenHeight/5.9, screenWidth/2, screenHeight/3.5, tocolor ( 255,255, 255, 180 ), 1.9, "default-bold","center" ) end This is part of code, I will like to get help with this, or get some suggestion to do it. Thanks and regards. ^^ Link to comment
Moderators IIYAMA Posted September 5, 2014 Moderators Share Posted September 5, 2014 did you ever worked with time? At school? Your setup: local timeStart = getTickCount() -- get the computer time of this moment local animationTime = 3000 -- 3 seconds -- This is how long your animation would take, --futureTime = timeNow + 3000 -- the time now + 3 seconds, this is when the animation part should stop Calculate the progress:(this is when you are drawing your text) local timeNow = getTickCount() -- get the computer time of this moment local differences = timeNow - timeStart -- calculate the differences between the start time of the animation and the time now of this moment. local progress = differences/animationTime -- factor = multiplier --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------- -- invert the progress? -- --progress = 1-progress ------------------------------ if progress <= 0 then -- check if the animation hasn't ended yet. local yourTextPosition = progress*distance end It is some basic math, to calculate progress. Or you can do it with a lot of timers, which I will not recommend.(and that isn't very smooth) Link to comment
Overkillz Posted September 5, 2014 Author Share Posted September 5, 2014 Thanks bro, it is ok ^^ Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now