Introducing LavaBeats - #428
Conversation
This is a utility to construct the LavaBeats haptic effect from pulse parameters that represent the QRS and T wave biomarker in an EKG
This encapsulates the business logic of playin the haptics beat effect as well as handling the graphical visualization triggers and logic
This is the runtime fragment shader that renders the graphical representation of a lava lamp, which beats at the same rythm of the haptic beat effect
This is the display of the runtime shader
These control the haptic effect parameters, which are also used to control the fragment shader visualization timings and beating
This finally adds the LavaBeatsScreen and introduces the demo into the samples app
alabiaga
left a comment
There was a problem hiding this comment.
1 comment, but a nit. Thanks!
| documentation = "https://source.android.com/docs/core/interaction/haptics", | ||
| apiSurface = UserInterfaceHapticsApiSurface, | ||
| tags = listOf("Haptics"), | ||
| content = { LavaBeats() }, |
There was a problem hiding this comment.
is my understanding correct that for devices < API Level 33, this sample app would just show an non interactive screen with the "Not supported .." notification. I know you are following the model for the previous haptic samples but am curious if we should just enclose the sample with the MinSdkBox,
e.g.
content = {
MinSdkBox(minSdk = Build.VERSION_CODES.BAKLAVA) {
LavaBeats()
}
Which would have the same effect and save the user a click from learning that it's not enabled for their device.
There was a problem hiding this comment.
This makes sense! However, the device not only has to have an API level >= 33, but its vibrator must also support envelope effects, so the MinSdkBox wouldn't be enough to perform this check unfortunately. Do you think its better to extend/add a function like MinSdkBox that lets us extend the support conditions so that we can apply them earlier like in this location?
There was a problem hiding this comment.
yea that would be ideal but out of scope for this change. We can add as a feature request for the future. Thanks!
There was a problem hiding this comment.
Sounds good. Thanks Aaron!
LavaBeats is an educational self-contained app that demonstrates the design of a complex haptic signal using advanced haptic PWLE APIs. By mapping bio-markers of a typical EKG signal into amplitude and frequency segments, the app is able to compose a vibration that beats and resembles the pulses of a beating heart. To accompany the haptic effect, the app has a "lava lamp" visualization that beats at the same rhythm as the haptic effect.
Users can modify the settings of the effect by changing amplitudes, frequencies, delays, number of beats and beats-per-minute to emulate different beating patterns and sensations.
This app will also have a section in the Android haptics public documentation, which will detail the design process and the mapping between biomarkers and haptic signal parameters.