Jump to content

DX image Fly in


Karuzo

Recommended Posts

Hey Guys,

so i have a dximages with some buttons and dx images.

Everythings works perfectly, but i wanted to make it more 'special'.

So i have a question. How do i let my images fly in ? I mean , it comes from the bottom of the screen to the middle.

I hope you understand me and could help me :-)

regards,

KRZO.

Link to comment

here is an example (untested):

local step = 0.05 -- Progress speed per frame (from 0 to 1.0) 
local x,y = guiGetScreenSize() -- get screen size 
local sx,sy = 400,300 -- predefining the size 
local px,py = x/2-sx/2,y -- middle of the screen by X, right behind the visible Y part. x/2-sx/2 stands for the middle of the screen. y means "after" the bottom screen edge 
local progress = 0 
  
function renderWindow() 
  progress = progress + step -- Increasing the progress each frame 
  if progress > 1 then -- Progress can't be more than 1 so let's limit it 
    progress = 1 
  end 
  py = interpolateBetween(y,0,0,y/2-sy/2,0,0,progress,"OutBounce") -- Look for "easing" in wiki to change the animation type 
  dxDrawRectangle(px,py,sx,sy,tocolor(0,0,0,170)) -- Rectangle as an example 
end 
addEventHandler("onClientRender",getRootElement(),renderWindow) 

Link to comment

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