How to create this type of animation?


How to make this type of tween?

Watching it at a slow pace, it appears that:
The colour of each is changed to green, then the size of 2 of the dimensions (the ones that determine the width) are both tweened to 0

Use Tween Service

Technically make the part green, smaller its size and make it transparent.

Here is my solution:

local TweenService = game:GetService('TweenService')

local Part = --- get your block here

local Info = TweenInfo.new(.25, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0)

local TweenColor = TweenService:Create(Part, Info, {Color = Color3.fromRGB(0,255,0)})
local TweenSizeStart = TweenService:Create(Part, Info, {Size = Vector3.new(0,0,0)})
local TweenSizeEnd =  TweenService:Create(Part, Info, {Size = Vector3.new(0,0,0)}) --- set the Vector3 value to the part default side

--- Close
TweenColor:Play()
TweenSizeStart:Play()

--- Open

Part.Color = Color3.fromRGB(255,0,0)
TweenSizeEnd:Play()
1 Like
local TweenService = game:GetService('TweenService')

local Part = --- get your block here

local Info = TweenInfo.new(.25, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 0)

local TweenSizeStart = TweenService:Create(Part, Info, {Size = Vector3.new(4,0,0)})
local TweenSizeEnd =  TweenService:Create(Part, Info, {Size = Vector3.new(4,1,1)})

local Status = true -- true = close

local function ChangeStatus()
if Status then
Part.Color = Color3.fromRGB(0,255,0)
TweenSizeStart:Play()
else
Part.Color = Color3.fromRGB(255,0,0)
TweenSizeEnd:Play()
end
Status = not Status
end

1 Like

Thank you I Have created it with this script (just changed some stuff)

1 Like

Thank you for helping, I have already created script

All you have to do is create 2 tween: one for the red laser & another for green laser.

local tweenService = game:GetService("TweenService")

local tweenRed = tweenService:Create(laser, TweenInfo.new(), {Size=SizeOfRedLaser;Transparency=0;Color=Color3.fromRGB(255,0,0)}
local tweenGreen = tweenService:Create(laser, TweenInfo.new(), {Size=SizeOfRedLaser;Transparency=1;Color=Color3.fromRGB(0,255,0)}

And then you just call tweenRed:Play() or tweenGreen:Play() to turn laser green/red

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.