Animated UI Messages for FiveM
- Uses native UI
- Smooth entry and exit animations
- Choose from a variety of effects (slide, bounce, fade, typewriter, etc)
- Optional callbacks can be set
- Fine control of position, size, color, etc
- Performant
- None
- Download and extract the package: https://github.com/Mobius1/AnimateUI/archive/master.zip
- Rename the
AnimateUI-master
directory toAnimateUI
- Drop the
AnimateUI
directory into your resources directory on your server - Add
start AnimateUI
in yourserver.cfg
- Edit
config.lua
to your liking - Start your server and rejoice!
The text can be shown by using the exports.AnimateUI:showMessage
function.
exports.AnimateUI:showMessage(Text, EntryEffect, Duration, Timeout, Settings, ExitEffect, Callback)
The Text
param is the text you want to show to the player.
The EntryEffect
param is the effect used to show the text to the player.
The Duration
param determines how long the entry effect will be played.
The Timeout
param determines how long the text is displayed before being removed.
The Settings
is a table of settings to override the defaults in config.lua
. Set to nil
to use the defaults.
Example:
exports.AnimateUI:showMessage(Text, EntryEffect, Duration, Timeout, {
Font = 4,
Size = 0.75,
Opacity = 0.8,
PositionY = 0.35
}, ExitEffect, Callback)
The ExitEffect
param can either be a string denoting the effect name to be used or a table. If the effect name is used then the duration of the exit effect will be the same as the entry duration (Duration
). You can define the duration of the exit animation by using a table:
exports.AnimateUI:showMessage("My Message", "FadeIn", 1000, 3000, nil, "FadeOut")
-- or
exports.AnimateUI:showMessage("My Message", "FadeIn", 1000, 3000, nil,
{
Effect = 'FadeOut', -- the exit effect to use
Duration = 1000 -- the duration the exit effect
})
The ExitEffect
param is optional and if left empty, the text will just disappear when done.
The Callback
param is optional, but when used will fire when the text has been hidden:
exports.AnimateUI:showMessage("My Message", "FadeIn", 1000, 3000, nil, "FadeOut", function()
-- Do something when the text has been hidden
end)
Entry effects can only be used to show the text and exit effects can only be used to hide the text.
FadeIn
FadeInUp
FadeInDown
FadeInLeft
FadeInRight
SlideInUp
SlideInDown
SlideInLeft
SlideInRight
BounceIn
BounceInUp
BounceInDown
BounceInLeft
BounceInRight
ElasticIn
ElasticInUp
ElasticInDown
ElasticInLeft
ElasticInRight
ZoomIn
TypewriterIn
FadeOut
FadeOutUp
FadeOutDown
FadeOutLeft
FadeOutRight
SlideOutUp
SlideOutDown
SlideOutLeft
SlideOutRight
BounceOut
BounceOutUp
BounceOutDown
BounceOutLeft
BounceOutRight
ElasticOut
ElasticOutUp
ElasticOutDown
ElasticOutLeft
ElasticOutRight
ZoomOut
TypewriterOut
If you require the text to be removed at anytime, you can utilise the exports.AnimateUI:removeMessage
function. To remove the message, you must store the ID beforehand:
local ID = exports.AnimateUI:showMessage("My Message", "FadeIn", 1000, 3000)
exports.AnimateUI:removeMessage(ID)
Removing the message cancels all animations, removes the text from the screen and kills any threads used.
AnimateUI comes with commands to demonstrate the included effects.
/AnimateUIDemo type
Available types:
all
- cycles thorugh all available effectsfade
- cycles thorugh all fade effectsslide
- cycles thorugh all slide effectsbounce
- cycles thorugh all bounce effectselastic
- cycles thorugh all elastic effectszoom
- cycles thorugh all zoom effectstypewriter
- cycles thorugh all typewriter effects
Pull requests welcome.
AnimateUI - Animated UI Messages for FiveM
Copyright (C) 2020 Karl Saunders
This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version.
This program Is distributed In the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty Of MERCHANTABILITY Or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License For more details.
You should have received a copy Of the GNU General Public License along with this program. If Not, see http://www.gnu.org/licenses/.