Jump to content

Animation in dx


Baron Noev

Recommended Posts

Posted

Hello, I’ve moved your topic to the appropriate section for best results! 

To fade you can decrease alpha until completely disappeared ? 
 

Also you can use this function to create some nice effects 

https://wiki.multitheftauto.com/wiki/InterpolateBetween

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

Posted
20 hours ago, Baron Noev said:

Hello,How can i make a animation in dx like a fade,i want to create a button!!

using interpolateBetween

Small example:

local abc = false
local alpha = 0
local tick = 0

function d()
  if abc then
    alpha = interpolateBetween(0, 0, 0, 255, 0, 0, (tick-getTickCount())/2500, "Linear")
    else
    alpha = interpolateBetween(255, 0, 0, 0, 0, 0, (tick-getTickCount())/2500, "Linear")
    end
  dxDrawRectangle(screenW * 0.2000, screenH * 0.3000, screenW * 0.0600, screenH * 0.0600, tocolor(255, 0, 0, alpha), false)
  end
addEventHandler("onClientRender", root, d)

function anim()
  if not animState then
    animState = true
    abc = true
    else
    animState = false
    abc = false
    end
  end
bindKey("f2", "down", anim)

 

  • Like 1

Social Media:

 

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...