Overkillz Posted September 5, 2014 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. ^^
Moderators IIYAMA Posted September 5, 2014 Moderators 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) Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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