Jump to content

HELP PEOPLE :(


Maruchan

Recommended Posts

And the people ?, I need help in this resource that I am doing. Random images pass very fast, I thought they would happen little by little but the truth is that I don't know how to make them happen every 2 or 5 seconds and with some effect. Could you give me a hand to finish it please? :(

 

		 local screenW, screenH = guiGetScreenSize()
		 local startTicking = getTickCount()
		 Efect = 0
		 
function Intro_Con_Imagenes()
		 
		 if Efect >= 0 then Efect = Efect + 1 end if Efect >= 255 then Efect = 255 end   
		 
		 local move = interpolateBetween(3, 0, 0, -06, 0, 0, ((getTickCount() - startTicking) / 5000), "InElastic") 		 
		 local images = math.random(1,7)
		 dxDrawImage(screenW*0,screenH*0 + move,screenW,screenH,"Imagenes/Login/intro-"..images..".png",0,0,0,tocolor(255,255,255,Efect),true)

end
addEventHandler('onClientRender',root,Intro_Con_Imagenes)

 

Link to comment
  • Moderators
2 hours ago, Maruchan said:

local images

Not random, but it does it's thing. 14000 / 7 = 2000 ms each image.

local images = math.max(math.ceil(7 * ((getTickCount() % 14000) / 14000)), 1)

 

 

getTickCount() % 14000

This gives you a value between 0 and 13999 in milliseconds. This value counts up, resets and counts up again.

 

(getTickCount() % 14000) / 14000)

Value between 0 and 0.999999999.

 

7 * ((getTickCount() % 14000) / 14000)

Value between 0 and 6.9999999

 

math.ceil(7 * ((getTickCount() % 14000) / 14000))

Value between 0 and 7. (very small chance that the value is 0)

 

math.max(math.ceil(7 * ((getTickCount() % 14000) / 14000)), 1)

Value between 1 and 7.

 

 

  • Like 2
Link to comment
  • Moderators
13 hours ago, Maruchan said:

¡Perfect bro!.....


And finally, I would like each image to have a different movement effect, would this be possible?

 local images = math.max(math.ceil(7 * ((getTickCount() % 14000) / 14000)), "CosineCurve", 1)

 

The easing?

-- The first 7 of this table are used:
local strEasingTypes = { "Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce", "SineCurve", "CosineCurve" }


local images = math.max(math.ceil(7 * ((getTickCount() % 14000) / 14000)), 1)
local move = interpolateBetween(3, 0, 0, -06, 0, 0, ((getTickCount() - startTicking) / 5000), strEasingTypes[images]) 		 
		 

 

 

  • Thanks 1
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...