Jump to content

×[مسأعدة]× getTickCout


iiv03

Recommended Posts

ألسلام عليكم ورحمة الله وبركاته عندي مشكله هنا حاولت اخلي النص لما يخلص الوقت بعدين يرجع النص للبدايه وكذا يبقى لانهائي

مبتدئ في برمجه لخبصت شوي وقد محاولت ماتزبط محاولتي

local tick = getTickCount()
addEventHandler("onClientRender", root, function()
		local progress = math.min((getTickCount()-tick)/2000,tick)
	test.moveX = interpolateBetween(test.moveX, test.moveY, 0, 1, 0, 0, progress, "Linear")
		dxDrawText("FOR TESTING A SOMETHING ALPHA 1.0",sX*0.35-test.moveX,sY*0.15,250,250,tocolor(255,255,255,255), 2.00, "default-build", "left", "center", false)
    end
)

 

Edited by xFabel
Link to comment

 ماتوقف عند 1 يعني ترجع من جديد CosineCurve & CosineCurve  هي نفسها تقريباً لأن

getTickCount عموماً, إذا تبغى نفس طريقتك استخدم متغير بدون

 

local tick = 0

addEventHandler("onClientRender", root, function()
	tick = tick + 0.01 
	local T = math.min( tick, 1 );
	if T == 1 then tick = 0 end
	test.moveX = interpolateBetween(test.moveX, test.moveY, 0, 1, 0, 0, T, "Linear")
	dxDrawText("FOR TESTING A SOMETHING ALPHA 1.0",sX*0.35-test.moveX,sY*0.15,250,250,tocolor(255,255,255,255), 2.00, "default-build", "left", "center", false)
    end
)

 

  • Like 1
Link to comment
  On 05/11/2019 at 11:42, xFabel said:

شسالفه مشكله ماحد يقدر يحله صعبه؟

Expand  

حاول تعدل اسلوبك اذا تبي احد يساعدك

المهم, سويت لك الكود على حسب الي فهمته منك

ما جربته

local tick = getTickCount()
local from, to = test.moveX, 1;
addEventHandler("onClientRender", root, function()
    local currentTick = getTickCount()
    local progress = (currentTick - tick) / 2000
    local position = interpolateBetween(from, 0, 0, to, 0, 0, progress, "Linear")
    dxDrawText("FOR TESTING A SOMETHING ALPHA 1.0", sX*0.35-position, sY*0.15, 250, 250, tocolor(255, 255, 255, 255), 2.00, "default-build", "left", "center", false)
    if progress >= 1 then
        tick = currentTick
        from, to = to, from
    end
end)

 

Edited by xiRocKyz
Link to comment
  On 08/11/2019 at 00:50, Sha67 said:

 ماتوقف عند 1 يعني ترجع من جديد CosineCurve & CosineCurve  هي نفسها تقريباً لأن

getTickCount عموماً, إذا تبغى نفس طريقتك استخدم متغير بدون

 


local tick = 0

addEventHandler("onClientRender", root, function()
	tick = tick + 0.01 
	local T = math.min( tick, 1 );
	if T == 1 then tick = 0 end
	test.moveX = interpolateBetween(test.moveX, test.moveY, 0, 1, 0, 0, T, "Linear")
	dxDrawText("FOR TESTING A SOMETHING ALPHA 1.0",sX*0.35-test.moveX,sY*0.15,250,250,tocolor(255,255,255,255), 2.00, "default-build", "left", "center", false)
    end
)

 

Expand  

مو كذا قصدي ذا لما يبدا الحركه توصل وتوقف هناك.

  On 08/11/2019 at 17:38, xiRocKyz said:

حاول تعدل اسلوبك اذا تبي احد يساعدك

المهم, سويت لك الكود على حسب الي فهمته منك

ما جربته


local tick = getTickCount()
local from, to = test.moveX, 1;
addEventHandler("onClientRender", root, function()
    local currentTick = getTickCount()
    local progress = (currentTick - tick) / 2000
    local position = interpolateBetween(from, 0, 0, to, 0, 0, progress, "Linear")
    dxDrawText("FOR TESTING A SOMETHING ALPHA 1.0", sX*0.35-position, sY*0.15, 250, 250, tocolor(255, 255, 255, 255), 2.00, "default-build", "left", "center", false)
    if progress >= 1 then
        tick = currentTick
        from, to = to, from
    end
end)

 

Expand  

مشكور والله هذا الي كان أقصده ممكن سؤال؟

وش سويت غلط عشان اسلوبي مو كويس

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