Created
April 5, 2020 02:14
-
-
Save Nimblz/f8d9a190cfee855e911bab9ceaa8e73f to your computer and use it in GitHub Desktop.
This file contains 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
-- Author: Nimblz (Austin Reuschle) | |
-- @123eee555 | |
-- extremely simple mass gui element tweener | |
-- designed with basic 2d particle fx in mind | |
local TweenService = game:GetService("TweenService") | |
return function(parent, numParticles, tweenInfo, initialPropsFunc, finalPropsFunc) | |
numParticles = numParticles or 5 | |
tweenInfo = tweenInfo or TweenInfo.new( | |
1, | |
Enum.EasingStyle.Quad, | |
Enum.EasingDirection.Out | |
) | |
for particleIdx = 1, numParticles do | |
local newParticle = Instance.new("ImageLabel") | |
local initialProps = initialPropsFunc(particleIdx) | |
for prop, value in pairs(initialProps) do | |
local isValidProp = pcall(function() | |
return newParticle[prop] ~= nil | |
end) | |
if isValidProp then | |
newParticle[prop] = value | |
end | |
end | |
newParticle.Parent = parent | |
local finalProps = finalPropsFunc(particleIdx, initialProps) | |
local particleTween = TweenService:Create(newParticle, tweenInfo, finalProps) | |
particleTween.Completed:Connect(function() | |
newParticle:Destroy() | |
end) | |
particleTween:Play() | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Te extrañamos <3 :'3