-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a scroll smooth step function #3909
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3909 +/- ##
==========================================
- Coverage 91.27% 91.26% -0.01%
==========================================
Files 935 935
Lines 60129 60131 +2
==========================================
- Hits 54880 54877 -3
- Misses 5249 5254 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
lib/wibox/container/scroll.lua
Outdated
local state = ((elapsed * speed) % (size)) / size | ||
-- The cosine function is scaled to map [0,1] to [0,2π] then it’s output is | ||
-- scaled from [1 -- -1 -- 1] to [0 -- 1 -- 0] | ||
return (size - visible_size) * (0.5 - 0.5*math.cos(state*6.2832)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 * math.pi
would be preferable to some magic number literal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s clearly more readable with it, I must admit I did not check if it existed in lua.
A very simple smooth step function for scroll based on a cosine.