Jump to content

للمحترفين : حل لمشكلتي؟


_Kinan

Recommended Posts

function popUp ()
	if not isAlreadyTimed and anim == false then
		el = source
		--sx = createAnimation(376,400,"OutBounce",500)
		sy = createAnimation(300,400,"OutBounce",500,function(e) guiSetSize(el,e,e/1.5,false) anim=true end, function(e) isAlreadyTimed = true anim=false added=false end)
	end
end
function popDown()
	if isAlreadyTimed and anim == false then
		sy = createAnimation(400,300,"OutBounce",500,function(e) guiSetSize(el,e,e/1.5,false) anim = true end, function(e) 	isAlreadyTimed = false anim = false end)
	end
end
function showMain(bool)
	for i,v in ipairs(thumbs) do
		addEventHandler("onClientMouseEnter",v,popUp)
		
		addEventHandler("onClientMouseLeave",v,popDown)
	end
	for i,v in ipairs(thumbs) do
		guiSetVisible(v,bool)
		showCursor(guiGetVisible(v))
	end
end
addEvent("showMain",true)
addEventHandler("showMain",root,showMain)
local anims, builtins = { }, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce"}
function table.find(t, v)
    for k,a in ipairs(t) do
        if a == v then return true end
    end
    return false
end
function createAnimation(f, t, easing, duration, onChange, onEnd)
    assert(type(f) == "number", "Bad argument @ 'createAnimation' [expected number at argument 1, got "..type(f).."]")
    assert(type(t) == "number", "Bad argument @ 'createAnimation' [expected number at argument 2, got "..type(t).."]")
    assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'createAnimation' [Invalid easing at argument 3]")
    assert(type(duration) == "number", "Bad argument @ 'createAnimation' [expected number at argument 4, got "..type(duration).."]")
    assert(type(onChange) == "function", "Bad argument @ 'createAnimation' [expected function at argument 5, got "..type(onChange).."]")
    return table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
end
addEventHandler("onClientRender", root, function( )
    local now = getTickCount( )
    for k,v in ipairs(anims) do
        v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
        if now >= v.start+v.duration then
            table.remove(anims, k)
            if type(v.onEnd) == "function" then
                v.onEnd( )
            end
        end
    end
end)
-- Useful function ^

السلام عليكم

انا مسوي صور لما يصير ايفينت
onClientMouseEnter  لما تدخل الماوس في ايليمنت جي يو اي

يصير الانيميشن
و

onClientMouseLeave لما تخرج الماوس من ايليمنت جي يو اي

يصير انيميشن العكسي...

والكود شغال تمام

طيب المشكلة وين؟

المشكلة :
لما يدخل الماوس, تصير الانيميشن. لكن لو طلعت الماوس قبل لا تخلص الأنيميشن. تضل الصورة زي ما هي...
 

Link to comment
6 minutes ago, _Kinan said:

function popUp ()
	if not isAlreadyTimed and anim == false then
		el = source
		--sx = createAnimation(376,400,"OutBounce",500)
		sy = createAnimation(300,400,"OutBounce",500,function(e) guiSetSize(el,e,e/1.5,false) anim=true end, function(e) isAlreadyTimed = true anim=false added=false end)
	end
end
function popDown()
	if isAlreadyTimed and anim == false then
		sy = createAnimation(400,300,"OutBounce",500,function(e) guiSetSize(el,e,e/1.5,false) anim = true end, function(e) 	isAlreadyTimed = false anim = false end)
	end
end
function showMain(bool)
	for i,v in ipairs(thumbs) do
		addEventHandler("onClientMouseEnter",v,popUp)
		
		addEventHandler("onClientMouseLeave",v,popDown)
	end
	for i,v in ipairs(thumbs) do
		guiSetVisible(v,bool)
		showCursor(guiGetVisible(v))
	end
end
addEvent("showMain",true)
addEventHandler("showMain",root,showMain)

local anims, builtins = { }, {"Linear", "InQuad", "OutQuad", "InOutQuad", "OutInQuad", "InElastic", "OutElastic", "InOutElastic", "OutInElastic", "InBack", "OutBack", "InOutBack", "OutInBack", "InBounce", "OutBounce", "InOutBounce", "OutInBounce"}
function table.find(t, v)
    for k,a in ipairs(t) do
        if a == v then return true end
    end
    return false
end
function createAnimation(f, t, easing, duration, onChange, onEnd)
    assert(type(f) == "number", "Bad argument @ 'createAnimation' [expected number at argument 1, got "..type(f).."]")
    assert(type(t) == "number", "Bad argument @ 'createAnimation' [expected number at argument 2, got "..type(t).."]")
    assert(type(easing) == "string" or (type(easing) == "number" and (easing >= 1 or easing <= #builtins)), "Bad argument @ 'createAnimation' [Invalid easing at argument 3]")
    assert(type(duration) == "number", "Bad argument @ 'createAnimation' [expected number at argument 4, got "..type(duration).."]")
    assert(type(onChange) == "function", "Bad argument @ 'createAnimation' [expected function at argument 5, got "..type(onChange).."]")
    return table.insert(anims, {from = f, to = t, easing = table.find(builtins, easing) and easing or builtins[easing], duration = duration, start = getTickCount( ), onChange = onChange, onEnd = onEnd})
end
addEventHandler("onClientRender", root, function( )
    local now = getTickCount( )
    for k,v in ipairs(anims) do
        v.onChange(interpolateBetween(v.from, 0, 0, v.to, 0, 0, (now - v.start) / v.duration, v.easing))
        if now >= v.start+v.duration then
            table.remove(anims, k)
            if type(v.onEnd) == "function" then
                v.onEnd( )
            end
        end
    end
end)
-- Useful function ^

السلام عليكم

انا مسوي صور لما يصير ايفينت
onClientMouseEnter  لما تدخل الماوس في ايليمنت جي يو اي

يصير الانيميشن
و

onClientMouseLeave لما تخرج الماوس من ايليمنت جي يو اي

يصير انيميشن العكسي...

والكود شغال تمام

طيب المشكلة وين؟

المشكلة :
لما يدخل الماوس, تصير الانيميشن. لكن لو طلعت الماوس قبل لا تخلص الأنيميشن. تضل الصورة زي ما هي...
 

شوف دي بق 

وقللنا شن قالك

Link to comment
Just now, Mohamed_king said:

شوف دي بق 

وقللنا شن قالك

ما يقول أي شي, الكود شغال بس المشكلة
لما يدخل الماوس, تصير الانيميشن. لكن لو طلعت الماوس قبل لا تخلص الأنيميشن. تضل الصورة زي ما هي...

Link to comment
2 minutes ago, iMr.WiFi..! said:

سوي عند فنكشن 

popDown

سوي 

or 

وحط الصورة الاصلية مباشرة بدون انميشن

function popDown()
	if isAlreadyTimed and anim == false then
		sy = createAnimation(400,300,"OutBounce",500,function(e) guiSetSize(el,e,e/1.5,false) anim = true end, function(e) 	isAlreadyTimed = false anim = false end)
    else 
    	guiSetSize(source,300,200)
	end
end

قصدك كذا؟

Link to comment

ابغى لو دخل الماوس, تجي انيمشن تكبر الصورة
و لو تصير انيمشن تصغير الصورة

كل شيء شغال بس المشكلة لو دخل الماوس و طلعها قبل لا تخلص انيميشن تكبير الصورة, الصورة تضل زي ما هي و ما تتصغر

 

Link to comment
12 minutes ago, خلف said:

سوي متغير فيلس

اذا دخل الماوس يتحقق انه فيلس و حط تايمر ع المدة حقت الانميشن يصير ترو

واعكس الوضع مع حدث خروجه

 

function popUp ()
	if not isAlreadyTimed and anim == false then
		el = source
		--sx = createAnimation(376,400,"OutBounce",500)
		sy = createAnimation(300,400,"OutBounce",500,function(e) guiSetSize(el,e,e/1.5,false)end, function(e) isAlreadyTimed = true added=false end)
		setTimer(function() anim = true end,500,1)
	end
end
function popDown()
	if isAlreadyTimed and  anim == true then
		setTimer(function() anim = false end,500,1)
		sy = createAnimation(400,300,"OutBounce",500,function(e) guiSetSize(el,e,e/1.5,false)end, function(e) 	isAlreadyTimed = false end)
	end
end

سويتها

و مالها علاقة بمشكلتي..

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