Created
December 8, 2014 21:09
-
-
Save braunsonm/3f068f19f20a1a8da16e to your computer and use it in GitHub Desktop.
Prismata Connection Screen in MTA
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function dxDrawCircle( posX, posY, radius, width, angleAmount, startAngle, stopAngle, color, postGUI ) | |
| if ( type( posX ) ~= "number" ) or ( type( posY ) ~= "number" ) then | |
| return false | |
| end | |
| local function clamp( val, lower, upper ) | |
| if ( lower > upper ) then lower, upper = upper, lower end | |
| return math.max( lower, math.min( upper, val ) ) | |
| end | |
| radius = type( radius ) == "number" and radius or 50 | |
| width = type( width ) == "number" and width or 5 | |
| angleAmount = type( angleAmount ) == "number" and angleAmount or 1 | |
| startAngle = clamp( type( startAngle ) == "number" and startAngle or 0, 0, 360 ) | |
| stopAngle = clamp( type( stopAngle ) == "number" and stopAngle or 360, 0, 360 ) | |
| color = color or tocolor( 255, 255, 255, 200 ) | |
| postGUI = type( postGUI ) == "boolean" and postGUI or false | |
| if ( stopAngle < startAngle ) then | |
| local tempAngle = stopAngle | |
| stopAngle = startAngle | |
| startAngle = tempAngle | |
| end | |
| for i = startAngle, stopAngle, angleAmount do | |
| local startX = math.cos( math.rad( i ) ) * ( radius - width ) | |
| local startY = math.sin( math.rad( i ) ) * ( radius - width ) | |
| local endX = math.cos( math.rad( i ) ) * ( radius + width ) | |
| local endY = math.sin( math.rad( i ) ) * ( radius + width ) | |
| dxDrawLine( startX + posX, startY + posY, endX + posX, endY + posY, color, width, postGUI ) | |
| end | |
| return true | |
| end | |
| function centerBalls () | |
| local screenW, screenH = guiGetScreenSize() | |
| local x, y = (screenW/2)-200,(screenH/2)-200 | |
| return x | |
| end | |
| local NUM_BALL = 24; | |
| local loadingBall = { } | |
| local timeStep = 0; | |
| local BALL_HEIGHT = 120; | |
| function animateBalls() | |
| for i = 0, NUM_BALL-1 do | |
| loadingBall[i] = dxDrawCircle(centerBalls()+10*i,getY(i,timeStep), 2, 2, _, _, _, tocolor(11, 95, 149)); | |
| timeStep = timeStep+1; | |
| end | |
| end | |
| function getY(i, t) | |
| return 260 + BALL_HEIGHT/2 * (1 + math.sin((t/10 * (i/500 + 0.02)) % 2*math.pi)); | |
| end | |
| addEventHandler("onClientRender", getRootElement(), animateBalls) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment