Skip to content

Commit

Permalink
Add interaction effects to SwitchInput
Browse files Browse the repository at this point in the history
  • Loading branch information
ImAvafe committed Sep 4, 2024
1 parent a6501b1 commit 1ed52bf
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/Components/SwitchInput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,18 @@ return function(Scope: Fusion.Scope<any>, Props: Props)
Theme.SpringSpeed["1"],
Theme.SpringDampening["1"]
),
Size = UDim2.fromScale(0, 1),
Size = Scope:Spring(
Scope:Computed(function(use)
local Scale = 0.85
if use(IsHovering) then
Scale *= 1.1
end

return UDim2.fromScale(0, Scale)
end),
Theme.SpringSpeed["1"],
Theme.SpringDampening["1"]
),
AutomaticSize = Enum.AutomaticSize.None,
BackgroundTransparency = Scope:Spring(
Scope:Computed(function(use)
Expand All @@ -201,7 +212,17 @@ return function(Scope: Fusion.Scope<any>, Props: Props)
Theme.SpringSpeed["1"],
Theme.SpringDampening["1"]
),
AspectRatio = 1,
AspectRatio = Scope:Spring(
Scope:Computed(function(use)
if use(IsHolding) then
return 1.2
else
return 1
end
end),
Theme.SpringSpeed["1"],
Theme.SpringDampening["1"]
),
AspectType = Enum.AspectType.ScaleWithParentSize,
DominantAxis = Enum.DominantAxis.Height,
CornerRadius = EffectiveCornerRadius,
Expand Down

0 comments on commit 1ed52bf

Please sign in to comment.