Type Index Pages
- BillboardGui
- CanvasGroup
- Frame
- Hint
- ImageButton
- ImageLabel
- PlayerGui
- ScreenGui
- ScrollingFrame
- StarterGui
- SurfaceGui
- TextBox
- TextButton
- TextLabel
- UIAspectRatioConstraint
- UIGradient
- UIGridLayout
- UIListLayout
- UIPadding
- UIPageLayout
- UIScale
- UISizeConstraint
- UITableLayout
- UITextSizeConstraint
- VideoFrame
- ViewportFrame
- ChangeHistoryService
- CoreGui
- DataModelSession
- DockWidgetPluginGui
- MultipleDocumentInterfaceInstance
- Plugin
- PluginAction
- PluginGui
- PluginGuiService
- PluginManager
- PluginMenu
- PluginMouse
- PluginToolbar
- PluginToolbarButton
- QWidgetPluginGui
- Selection
- StandalonePluginScripts
- StatsItem
- StudioService
- StudioTheme
No results found!
-
Instance
- GameSettings
- DebugSettings
- BodyMover
- WeldConstraint
- HttpRbxApiService
- NotificationService
- Translator
- Lighting
- Beam
- GuiService
- UserInputService
- Studio
- Plugin
- HttpService
- Mouse
- BindableEvent
- RunService
- Pages
- Humanoid
- TestService
- PathfindingService
- Chat
- NetworkPeer
- Feature
- CharacterAppearance
- Constraint
- NetworkReplicator
- JointInstance
- Light
- BasePlayerGui
- AnalyticsService
- NetworkMarker
- BinaryStringValue
- FlyweightService
- Geometry
- LoginService
- InstancePacketCache
- ThirdPartyUserService
- TouchInputService
- RuntimeScriptService
- GuidRegistryService
- PartOperationAsset
- DialogChoice
- PhysicsService
- AdService
- TextService
- MarketplaceService
- TeleportService
- Accoutrement
- GamePassService
- AssetService
- InsertService
- PointsService
- ChangeHistoryService
- ServerScriptService
- JointsService
- LogService
- InputObject
- Toolbar
- LuaSettings
- RenderSettings
- AnimationTrack
- PhysicsSettings
- NetworkSettings
- CFrameValue
- Animation
- Color3Value
- BoolValue
- BrickColorValue
- Vector3Value
- AnimationController
- BindableFunction
- Button
- Trail
- LocalizationTable
- LocalizationService
- DebuggerBreakpoint
- DebuggerWatch
- ScriptDebugger
- Animator
- Attachment
- RemoteFunction
- RemoteEvent
- PluginManager
- Camera
- Stats
- Sky
- StarterPlayer
- Dragger
- TerrainRegion
- Path
- TextFilterResult
- Dialog
- StatsItem
- GoogleAnalyticsConfiguration
- ScriptContext
- ControllerService
- CacheableContentProvider
- ReflectionMetadataClasses
- ReflectionMetadataEnums
- DebuggerManager
- GuiBase
- UIBase
- LuaSourceContainer
- GuiItem
- DataModelMesh
- ServiceProvider
- ReflectionMetadataItem
- PostEffect
- PhysicsPacketCache
- TouchTransmitter
- RobloxReplicatedStorage
- Visit
- LuaWebService
- ScriptService
- FlagStandService
- VirtualUser
- SpawnerService
- TimerService
- CookiesService
- Team
- GroupService
- StarterGear
- Message
- PlayerScripts
- Configuration
- ContentProvider
- CollectionService
- Debris
- ReplicatedFirst
- ServerStorage
- ReplicatedStorage
- Folder
- TweenService
- Players
- ContextActionService
- StarterPlayerScripts
- SoundService
- KeyframeSequenceProvider
- VRService
- PluginGuiService
- Player
- Teams
- Pose
- Keyframe
- KeyframeSequence
- IntConstrainedValue
- DoubleConstrainedValue
- ForceField
- RayValue
- Fire
- Smoke
- Sparkles
- ParticleEmitter
- IntValue
- StringValue
- NumberValue
- Explosion
- ObjectValue
- SoundGroup
- UserGameSettings
- ClickDetector
- Sound
- Selection
- BadgeService
- TaskScheduler
- GlobalDataStore
- DataStoreService
- CustomEvent
- CustomEventReceiver
- VirtualInputManager
- FunctionalTest
- TweenBase
- SoundEffect
- ReflectionMetadataEvents
- ClusterPacketCache
- PVInstance
- FaceInstance
- Controller
- ReflectionMetadataCallbacks
- ReflectionMetadataFunctions
- ReflectionMetadataYieldFunctions
- ReflectionMetadataProperties
- ReflectionMetadata
- AdvancedDragger
- HapticService
- FriendService
- GamepadService
No Result Found !!!
ColorSequence
ColorSequence
A ColorSequence represents a gradient of color values from 0 to 1. The color values are expressed using the datatype/ColorSequenceKeypoint
type. This type is used in various properties of ParticleEmitter
, Trail
, and Beam
. In Studio, this data type is edited using a gradient editor:
The above gradient can be set using a script using the following call to ColorSequence.new:
local white = Color3.new(1, 1, 1) local lightBlue = Color3.new(0, 2/3, 1) local yellow = Color3.new(1, 1, 0) particleEmitter.Color = ColorSequence.new{ ColorSequenceKeypoint.new(0, white), ColorSequenceKeypoint.new(0.25, lightBlue), ColorSequenceKeypoint.new(0.5, white), ColorSequenceKeypoint.new(0.75, yellow), ColorSequenceKeypoint.new(1, white) }
Equality
Two ColorSequences are equivalent if and only if the values of their datatype/ColorSequenceKeypoint
are equivalent, even if the two ColorSequence would result in similar gradients.
Evaluation
The ColorSequence type does not have a built-in method for getting the value at a certain time/point. However, you can use the following function to evaluate at a specific time.
function evalCS(cs, time) -- If we are at 0 or 1, return the first or last value respectively if time == 0 then return cs.Keypoints[1].Value end if time == 1 then return cs.Keypoints[#cs.Keypoints].Value end -- Step through each sequential pair of keypoints and see if alpha -- lies between the points' time values. for i = 1, #cs.Keypoints - 1 do local this = cs.Keypoints[i] local next = cs.Keypoints[i + 1] if time >= this.Time and time < next.Time then -- Calculate how far alpha lies between the points local alpha = (time - this.Time) / (next.Time - this.Time) -- Evaluate the real value between the points using alpha return Color3.new( (next.Value.R - this.Value.R) * alpha + this.Value.R, (next.Value.G - this.Value.G) * alpha + this.Value.G, (next.Value.B - this.Value.B) * alpha + this.Value.B ) end end end
You can use the function above like this:
local cs = ColorSequence.new{ ColorSequenceKeypoint.new(0, BrickColor.new("Really red").Color), ColorSequenceKeypoint.new(1, BrickColor.new("Really blue").Color) } print(evalCS(cs, 0.5)) --> 0.5, 0, 0.5 (purple, since we're half way between red and blue)
Constructors
ColorSequence.new ( Color3 c ) |
Creates a sequence of two keypoints with local cs = ColorSequence.new(c) -- is equivalent to local cs = ColorSequence.new{ ColorSequenceKeypoint.new(0, c), ColorSequenceKeypoint.new(1, c) } |
ColorSequence.new ( Color3 c0, Color3 c1 ) |
Creates a sequence of two keypoints with local cs = ColorSequence.new(c0, c1) -- is equivalent to local cs = ColorSequence.new{ ColorSequenceKeypoint.new(0, c0), ColorSequenceKeypoint.new(1, c1) } |
ColorSequence.new ( table keypoints ) |
Creates a sequence given an array of ColorSequenceKeypoints. The keypoints must be provided in a non-descending time value order. At least two keypoints must be provided, and they must have a time value of 0 (first) and 1 (last). local white = Color3.new(1, 1, 1) local lightBlue = Color3.new(0, 2/3, 1) local yellow = Color3.new(1, 1, 0) local cs = ColorSequence.new{ ColorSequenceKeypoint.new(0, white), ColorSequenceKeypoint.new(0.25, lightBlue), ColorSequenceKeypoint.new(0.5, white), ColorSequenceKeypoint.new(0.75, yellow), ColorSequenceKeypoint.new(1, white) } |
Properties
table ColorSequence.Keypoints |
An array containing ColorSequenceKeypoint values for the ColorSequence. |
How this site use cookies
This Platform uses cookies to offer you a better experience, to personalize content, to provide social media features and to analyse the traffic on our site. For further information, including information on how to prevent or manage the use of cookies on this Platform, please refer to our Privacy and Cookie Policy.