Skip to content
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 logValue Method for Range Inputs to p5.Element #7246

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nimanns
Copy link

@nimanns nimanns commented Sep 7, 2024

Changes:
This PR introduces a new method, logValue, to the p5.Element prototype for range () elements. This method allows users to map slider values logarithmically, which is particularly useful for applications like audio volume control, where perception of changes follows a logarithmic rather than linear scale.

Changed files are: src/dom/dom.js and test/unit/dom/dom.js

Screenshots of the change:

PR Checklist

nimanns and others added 2 commits September 6, 2024 22:17
- Implemented a method called logValue on p5.Element prototype for <input type="range"> elements
- Allows slider values to be mapped to a logarithmic scale between min and max
- Ensures that values reach exactly min at the lowest and max at the highest positions
- Useful for applications such as audio volume control, brightness, and other parameters requiring logarithmic scaling
Copy link

welcome bot commented Sep 7, 2024

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already. And be sure to add yourself to the list of contributors on the readme page!

@ashish1729
Copy link
Contributor

is this based on some issue? I am curious why we add this directly to the element and not create mapping functionality / utillity to the logarithmic domain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants