fatboy950412 Posted June 12, 2021 Share Posted June 12, 2021 function dxDrawBorderedText (outline, text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY) local outline = (scale or 1) * (1.333333333333334 * (outline or 1)) dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left - outline, top, right - outline, bottom, tocolor (0, 0, 0, 225), scale, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY) dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left + outline, top, right + outline, bottom, tocolor (0, 0, 0, 225), scale, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY) dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left, top - outline, right, bottom - outline, tocolor (0, 0, 0, 225), scale, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY) dxDrawText (text:gsub("#%x%x%x%x%x%x", ""), left, top + outline, right, bottom + outline, tocolor (0, 0, 0, 225), scale, font, alignX, alignY, clip, wordBreak, postGUI, false, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY) dxDrawText (text, left, top, right, bottom, color, scale, font, alignX, alignY, clip, wordBreak, postGUI, colorCoded, subPixelPositioning, fRotation, fRotationCenterX, fRotationCenterY) end function fadedText() dxDrawBorderedText(2.5, "Lorem ipsum dolor sit amet", 0, 0, screenX, screenY - (screenY * 0.9), tocolor(176,192,222,255), 2, "pricedown", "center", "center", true, true, true, true, true) dxDrawBorderedText(2.5, "Lorem ipsum dolor sit amet.", 0, 0, screenX, screenY - (screenY * 0.84), tocolor(135,206,250,255), 1, Roboto, "center", "center", true, true, true, true, true) setTimer(function() removeEventHandler("onClientRender", root, fadedText) end, 3000, 1) end function fadedHit( theElement, matchingDimension ) if ( theElement == localPlayer ) then addEventHandler("onClientRender", root, fadedText) end end addEventHandler("onClientColShapeHit", groveCol, fadedHit) // im trying to fade this script but i cant can someone help me pls Link to comment
βurak Posted June 12, 2021 Share Posted June 12, 2021 hi you can use textlib for this kind of stuff I use it too it works example local screenW, screenH = guiGetScreenSize() test = dxText:create("Test", screenW/2, screenH/2, false) test:font("default-bold") test:scale(4.0) test:color(255,255,255,255) test:visible(false) addCommandHandler("fade", function() test:visible(true) Animation.createAndPlay(test, dxTextFadeIn(3000)) end ) Link to comment
JeViCo Posted June 13, 2021 Share Posted June 13, 2021 (edited) You probably need something like this: function drawStuff( alpha ) local alpha = alpha or 255 local color = tocolor( 255, 255, 255, alpha ) -- draw something end local gAlpha = 0 function fadeExample( ) -- goes from 0 to 255 drawStuff( gAlpha) gAlpha = gAlpha + 0.05 if gAlpha == 255 then removeEventHandler( "onClientRender", root, fadeExample ) end end addEventHandler( "onClientRender", root, fadeExample ) Edited June 13, 2021 by JeViCo snippet to code formatting 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