spaghetti1337 Posted October 7, 2021 Share Posted October 7, 2021 I want to make signature more realistic, I'm using a signature font with dxDrawText it's looks like a real signature but I want to make that looks like when you are signature some document in real life. I getting the character name with getElementData: local name = getElementData(localPlayer, "char:name") Suppose that the localPlayer's name is "John Cena" how can I do that "John Cena" is displaying on the screen slowly (but smoothly) letter by letter with dxDrawText? What is the logic behind it? May I need timers and? Link to comment
The_GTA Posted October 7, 2021 Share Posted October 7, 2021 It sounds like you want to tie the amount of letters drawn by dxDrawText to a function based on the elapsed time. You can calculate the elapsed time in milliseconds by taking two time samples using getTickCount and subtracting the first one from the second. Then you have a positive number that you can multiply by a factor and then multiply with the amount of character ("John Cena" is 9 characters if you count the space character). Then you use the string.sub function in combination with the calculated character count to get the delimited text for drawing. Good luck! Link to comment
spaghetti1337 Posted October 7, 2021 Author Share Posted October 7, 2021 35 minutes ago, The_GTA said: It sounds like you want to tie the amount of letters drawn by dxDrawText to a function based on the elapsed time. You can calculate the elapsed time in milliseconds by taking two time samples using getTickCount and subtracting the first one from the second. Then you have a positive number that you can multiply by a factor and then multiply with the amount of character ("John Cena" is 9 characters if you count the space character). Then you use the string.sub function in combination with the calculated character count to get the delimited text for drawing. Good luck! Hello, Thank you. But what about string.len? I mean I use string.len for get the character count and then how can I get letter by letter? I need to set a timer for every character or what? Sorry but I don't understand this logic well Link to comment
The_GTA Posted October 7, 2021 Share Posted October 7, 2021 1 minute ago, spaghetti1337 said: Sorry but I don't understand this logic well I am afraid this has a lot to do with math. Did you have basic math at school? Did you by chance also attend physics classes? Then you should know what a function with parameter t is, the time. drawing speed = 9 characters divided by 5 seconds (5000ms) elapsed time ms = now - start (obtained by two getTickCount() samples) drawing length in characters = drawing-speed-ms * elapsed-time-ms 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