Add smoothing transition for value changes to simulate inertia and slow pointers#15
Open
tigert wants to merge 1 commit into
Open
Add smoothing transition for value changes to simulate inertia and slow pointers#15tigert wants to merge 1 commit into
tigert wants to merge 1 commit into
Conversation
…pointers etc. Simulator flight model data might give you instant values, while physical gauges have delay and inertia. New files: -index.ts, useSmoothedValue.ts in packages/core/src/animation: Use Vue's transition to return a smoothed change of the value over time. Duration of 0 means no smoothing happens.. - packages/core/src/index.ts: export useSmoothedValue from core.
Author
|
I could also just do this in a gauge, but I figured this might be useful for the framework in general. In any case I wanted to say "hello" after our chat at FSWeekend, so I might as well bring a PR along. Let me know what you think. I added that slider to the RPM testbed only locally, since I wanted to keep the patch minimal. |
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.
Problem to solve
Simulator data sent from an API often reflects values from the simulator flight model, but gauges with physical pointers often have inertia and react slower to value changes. Mechanical simulated gauges of course have the same restrictions that play to their advantage in this case. You sometimes want to simulate this also on digital on-screen gauges.
This PR adds the built-in Vue transition function to core, that seems to do a pretty OK job at simulating inertia on gauge pointers and also value labels that seem to change at more constant flow. It uses the easeOutExpo transition and depending on the duration, it can feel quite good.
This is also especially useful if you want to simulate electrical instruments when the aircraft battery switch is turned on or off, the pointers drift towards zero quite realistically even if your flight model electrical system does not simulate voltage decay :-)
Recording.2026-06-10.174705.mp4
New files:
index.ts,useSmoothedValue.tsinpackages/core/src/animation: Use Vue's built-in transition to return a smoothed change of the value over time. Duration of 0 means no smoothing happens..