coNolel Posted February 2, 2017 Share Posted February 2, 2017 السلآم عليكم ورحمة الله تعالى وبركاته اليوم ي عيال سويت كم شي بسيط دي إكس اجرب وش ف مخي ولقيت صعوبة ف فنكشن interpolateBetween لكن بحمد الله تغلبت عليها والحين جت ع بالي فكرة اني اسوي بها انميشين لا منتهي يعني timeless مثلا انا مسوي مستطيل كبير زي خلفية يوم يشتغل السكربت يجي alpha من 0 إلى 255 1لكن يوم يصير Progress يوقف الأنميشن كيف أخليه يوم يوصل progress 1 يرجع ينقص إلى الصفر وبكذا ما يخلص الإفكت حقه او الأنميشين ابد ض1 الكود : <lua>local timing = 0 function test() timing = timing + 0.02 if timing >=1 then timing = timing - 0.02 end backgroundAlpha = interpolateBetween ( 0, 0, 0, 255, 0, 0, timing, "Linear" ) dxDrawRectangle(0, 0, sX, sY, tocolor(255, 255, 255, backgroundAlpha), false) -- background end </lua> وشكرا جزيلآ ، السلام خير ختام ف أمان الله Link to comment
N3xT Posted February 2, 2017 Share Posted February 2, 2017 يفترض الفنكشن يكون داخل الرندر عشان يتغير كل شوي والحد الأعلى للشفافية 255 ليه حاطها على 1 ؟ Link to comment
خلف Posted February 2, 2017 Share Posted February 2, 2017 local Timing = 0 addEventHandler ( "onClientRender", root, function () Timing = Timing + 0.02 backgroundAlpha = interpolateBetween ( 0, 0, 0, 255, 0, 0, Timing, "Linear" ) if backgroundAlpha >= 255 then Timing = 0 end dxDrawRectangle(0, 0, 800, 600, tocolor ( 255, 255, 255, backgroundAlpha ), false) end ) 1 Link to comment
coNolel Posted February 2, 2017 Author Share Posted February 2, 2017 أظن انو فيه غلط ، يوم جربت حقك ي خلف طلع عندي يوم يجي 255 يعيد ، وانا أبيه يرجع عد تناقصي 19 minutes ago, خلف said: local Timing = 0 addEventHandler ( "onClientRender", root, function () Timing = Timing + 0.02 backgroundAlpha = interpolateBetween ( 0, 0, 0, 255, 0, 0, Timing, "Linear" ) if backgroundAlpha >= 255 then Timing = 0 end dxDrawRectangle(0, 0, 800, 600, tocolor ( 255, 255, 255, backgroundAlpha ), false) end ) Link to comment
خلف Posted February 2, 2017 Share Posted February 2, 2017 (edited) Alpha = 0 setTimer ( function ( ) if Alpha == 1 then StartA = getTickCount ( ) Alpha = 0 elseif Alpha == 0 then StartA = getTickCount ( ) Alpha = 1 end end, 3000, 0 ) addEventHandler ( "onClientRender", root, function ( ) if Alpha == 0 then Hide ( ) else Show ( ) end dxDrawRectangle(0, 0, 800, 600, tocolor ( 255, 255, 255, backgroundAlpha ), false) end ) function Hide ( ) local now = getTickCount ( ) local endTime = StartA - 3000 local elapsedTime = now - StartA local duration = endTime - StartA local progress = elapsedTime / duration backgroundAlpha = interpolateBetween ( 0, 0, 0, 255, 0, 0, progress, "Linear" ) Alpha = 0 end function Show ( ) local now = getTickCount ( ) local endTime = StartA + 3000 local elapsedTime = now - StartA local duration = endTime - StartA local progress = elapsedTime / duration backgroundAlpha = interpolateBetween ( 0, 0, 0, 255, 0, 0, progress, "Linear" ) Alpha = backgroundAlpha + Alpha Alpha = 1 end الكود شغال لاكن بيجي خطاء بالديبوق Edited February 2, 2017 by خلف 1 Link to comment
N3xT Posted February 2, 2017 Share Posted February 2, 2017 34 minutes ago, خلف said: Alpha = 0 setTimer ( function ( ) if Alpha == 1 then StartA = getTickCount ( ) Alpha = 0 elseif Alpha == 0 then StartA = getTickCount ( ) Alpha = 1 end end, 3000, 0 ) addEventHandler ( "onClientRender", root, function ( ) if Alpha == 0 then Hide ( ) else Show ( ) end dxDrawRectangle(0, 0, 800, 600, tocolor ( 255, 255, 255, backgroundAlpha ), false) end ) function Hide ( ) local now = getTickCount ( ) local endTime = StartA - 3000 local elapsedTime = now - StartA local duration = endTime - StartA local progress = elapsedTime / duration backgroundAlpha = interpolateBetween ( 0, 0, 0, 255, 0, 0, progress, "Linear" ) Alpha = 0 end function Show ( ) local now = getTickCount ( ) local endTime = StartA + 3000 local elapsedTime = now - StartA local duration = endTime - StartA local progress = elapsedTime / duration backgroundAlpha = interpolateBetween ( 0, 0, 0, 255, 0, 0, progress, "Linear" ) Alpha = backgroundAlpha + Alpha Alpha = 1 end الكود شغال لاكن بيجي خطاء بالديبوق if not StartA then return end 1 Link to comment
Abdul KariM Posted February 2, 2017 Share Posted February 2, 2017 جرب كذا local aState = false local Timing = 0 addEventHandler ( "onClientRender", root, function ( ) if ( aState == false ) then Timing = Timing + 0.02 elseif ( aState == true ) then Timing = Timing - 0.02 end backgroundAlpha = interpolateBetween ( 0, 0, 0, 255, 0, 0, Timing, "Linear" ) if ( backgroundAlpha >= 255 ) then aState = true elseif ( backgroundAlpha <= 0 ) then aState = false end dxDrawRectangle(0, 0, 800, 600, tocolor ( 255, 255, 255, backgroundAlpha ), false) end ) 2 Link to comment
coNolel Posted February 2, 2017 Author Share Posted February 2, 2017 يعطيكم العافية خلآص تمت الإفادة Link to comment
Abdul KariM Posted February 2, 2017 Share Posted February 2, 2017 الله يعافيك اية واحد ضبط معك ؟ Link to comment
N3xT Posted February 2, 2017 Share Posted February 2, 2017 Just now, Abdul KariM said: الله يعافيك اية واحد ضبط معك ؟ كلها شغالة Link to comment
coNolel Posted February 2, 2017 Author Share Posted February 2, 2017 تبي الصراحة ما جربت إلى حقت كركر ههههههههه اختصرت علي الموضوع بس الشباب كلهم مبدعين من ألف إلى يآء Link to comment
#BrosS Posted February 2, 2017 Share Posted February 2, 2017 20 minutes ago, coNolel said: كركر من كركر ؟ 1 Link to comment
خلف Posted February 2, 2017 Share Posted February 2, 2017 4 minutes ago, #BrosS said: من كركر ؟ عبد الكريم 3 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now