Added a custom theme editor to the demo page - #4
Merged
Merged
Conversation
The random starting values were written as their own set of literals, separate from propertyRanges, and the two drifted apart: five of the six sliders could open outside their own min/max. The browser clamps the thumb but not the theme, so the slider showed one value while the sound used another — 10 of 12 fresh opens had at least one desynced control. Seed from propertyRanges instead, snapped to the slider's step, so the two can't disagree. Also stop feeding non-numbers to Web Audio. `parseFloat(value) || value` put "" or "abc" straight into the theme when a number box was cleared or given text, and the next sound threw out of the generator: baseFreq "" -> RangeError: exponentialRampToValueAtTime target (0) attack "abc" -> TypeError: linearRampToValueAtTime non-finite The boxes are now type=number and updateTheme ignores anything non-finite, normalizing on blur. Edits no longer write back to the control being edited, so typing a multi-digit value isn't clobbered. Smaller fixes alongside: give the theme a `name` (TiksTheme requires it, and the demo is the example people copy); associate every label with its control; scope the preset handler to `.theme-btn[data-theme]` so it stops clearing the editor's own buttons.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.