xDeltaXen
(xDeltaXen)
April 27, 2021, 9:17pm
#1
I have create a script but I am unsure if it is practical as it pauses on red for a tiny but because it uses sine
local Frequency = 1
local AngularFrequency = 2 * math.pi * Frequency / 255
local Phase = math.rad(0)
game:GetService("RunService").RenderStepped:Connect(function()
Part.Color = Color3.fromHSV(math.abs(math.sin(AngularFrequency * tick() + Phase)), 1, 1)
end)
is there a better way?
1 Like
cmodii
(cmodii)
April 27, 2021, 9:19pm
#2
I am unsure if you’re trying to get specific values, but you can just use this:
BrickColor.random()
1 Like
xDeltaXen
(xDeltaXen)
April 28, 2021, 4:22pm
#3
No smooth transitions between all colours
1 Like
You can just tween the color using TweenService.
1 Like
xDeltaXen
(xDeltaXen)
April 28, 2021, 4:35pm
#5
Tween through all the colours of RGB. I am looking for something like my script that does not pause long on red
1 Like
Just choose 5-10 checkpoints in this spectrum, and tween per checkpoint.
1 Like
xDeltaXen
(xDeltaXen)
April 28, 2021, 4:40pm
#7
How is that more efficient then what I am doing?
1 Like
7z99
(cody)
April 28, 2021, 5:32pm
#8
You could just use TweenService on a NumberValue to do it.
local tweenService = game:GetService('TweenService')
local numberValue = Instance.new('NumberValue')
local part = workspace.Part
local tween = tweenService:Create(numberValue, TweenInfo.new(10, Enum.EasingStyle.Linear), {Value = 1})
numberValue.Changed:Connect(function()
part.Color = Color3.fromHSV(numberValue.Value, 1, 1)
end)
while true do
tween:Play()
tween.Completed:Wait()
numberValue.Value = 0
end
TweenService is used to create `Class.Tween`s, which are used to interpolate,
or tween, the properties of instances. `Class.Tween`s can be used on any
object with compatible property types.
1 Like
xJon_as
(Jonas)
April 28, 2021, 6:18pm
#9
Hi!
Make a script and insert this code. Make sure to insert the script in the part you’d like to tween.
local tweenService = game:GetService("TweenService");
local tweenInfo = TweenInfo.new(
1,
Enum.EasingStyle.Quad,
Enum.EasingDirection.InOut
)
function tweenParentColor(color)
local PanelSlideTween = tweenService:Create(script.Parent, tweenInfo, {
Color = color
})
PanelSlideTween:Play()
wait(1)
return
end
while true do
-- red
tweenParentColor(Color3.new(1, 0, 0));
-- orange
tweenParentColor(Color3.new(1, 0.647, 0));
-- yellow
tweenParentColor(Color3.new(1, 1, 0));
-- green
tweenParentColor(Color3.new(0, 0.502, 0));
-- blue
tweenParentColor(Color3.new(0, 0.333333, 1));
-- blue
tweenParentColor(Color3.new(0, 0, 1));
-- Indigo
tweenParentColor(Color3.new(0.294, 0, 0.510));
-- Indigo
tweenParentColor(Color3.new(0.9333333, 0.510, 0.9333333));
end
1 Like
This should work?
for i = 1, 360 do
local col = Color3.fromHSV(i/360, 1, 1)
end
2 Likes
cmodii
(cmodii)
April 29, 2021, 10:30pm
#11
Then consider usage of TweenService