Jump to content

Animations on text (?)


'LinKin

Recommended Posts

Posted

Hello,

As you know, it exists a script for making animations with an image. (i.e Hurry up! Image in Race)

But I was wondering, if there's a way to apply animations like these to a text draw by dxDrawText.

Seems impossible for me, but I want to make sure :)

Thanks,

LinKin.

Need a clanwar script? Click here!

Do you want some free scripts for your DD server? Visit my website.

Posted (edited)
Hello,

As you know, it exists a script for making animations with an image. (i.e Hurry up! Image in Race)

But I was wondering, if there's a way to apply animations like these to a text draw by dxDrawText.

Seems impossible for me, but I want to make sure :)

Thanks,

LinKin.

"talk more about this animation(type animation)"

Edited by Guest

MTA Scripters. ♥♥♥Beijinhos♥♥♥

Posted

If you're looking to move the text from one position to another, or one scale to another (anything you can edit about it really) then you can use

interpolateBetween 

Combined with the several easing functions you can make all sorts of animations with this function

350x20_FFFFFF_FFFFFF_000000_000000.png

350x20_FFFFFF_FFFFFF_000000_000000.png

350x20_FFFFFF_FFFFFF_000000_000000.png

Posted

Didn't test though.

  
local x,y = guiGetScreenSize() 
local defScale = 1 
local currentScale = defScale 
local maxScale = 3 
local step = 0.3 -- How fast to change the size 
local turn = true -- true = increase size, false = decrease size 
local font = "default-bold" 
local text = "This texts pulses" 
  
function renderPulse() 
  if turn == true then -- If we increase the value 
    currentScale = currentScale + step 
    if currentScale > maxScale then 
      currentScale = maxScale 
      turn = false -- Reached max? Then make it go back 
    end 
  else 
    currentScale = currentScale - step 
    if currentScale < defScale then 
      currentScale = defScale 
      turn = true 
    end 
  end 
  local width = dxGetTextWidth(text,currentScale,font) 
  local height = dxGetFontHeight(currentScale,font) 
  dxDrawText(text,x/2-width/2,y/2-height/2,width,height,tocolor(255,255,255,255),currentScale,font) 
end 
addEventHandler("onClientRender",getRootElement(),renderPulse) 
  

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...