When I shipped a small meditation and breathing app, built as an indie developer, the on-screen circle would expand and contract slowly, yet nothing reached the fingertips. People use this kind of app with their eyes closed, and I was guiding the breath with vision alone.
So I added expo-haptics and tried buzzing on the inhale and exhale cues. But Haptics.impactAsync() can only produce a single, instantaneous tap. What I wanted was a wave that swells over four seconds, pauses, and then fades over eight — something that rides along with the breath itself. No amount of stacking single taps gives you that continuous sensation.
The Taptic Engine in an iPhone is capable of far more nuance than that, and CoreHaptics is the API that unlocks it. Here we'll build a breath-synced haptic using CoreHaptics continuous events and parameter curves, then wrap it as an Expo native module so a React Native app (one generated with Rork) can call it — with the implementation code as we go.
Why expo-haptics alone never becomes a breath
expo-haptics exposes two broad families: the impact feedback of impactAsync(style) (light / medium / heavy) and the success/warning/error cues of notificationAsync(type). Both are designed to fire a single, very short, predefined pattern once.
A breathing wave needs something different in kind. What's missing comes down to three things:
- Duration — a continuous vibration that lasts several uninterrupted seconds
- A changing strength — the intensity rising and falling smoothly within those seconds
- Phase control — being able to specify the inhale, hold, and exhale phases in seconds
expo-haptics offers none of these. Scheduling presets with setTimeout leaves silent gaps between them, so you get a dotted line instead of a wave. To let someone feel the breath in their fingertips, you have to design the vibration as a continuous event and move its strength along a curve over time. That is exactly what CoreHaptics does.
| What you want | expo-haptics | CoreHaptics |
|---|---|---|
| A momentary tap | Great at it | Possible (transient event) |
| A multi-second continuous buzz | Not possible | Continuous event |
| Smoothly varying strength over time | Not possible | Parameter curve |
| Ease of adoption | A few lines | Needs a native module |
So it isn't an either/or choice. The pragmatic path is to leave taps to expo-haptics and add only the breathing wave through CoreHaptics. That's the arrangement I settled on myself.
CoreHaptics continuous events and parameter curves
The key to expressing a breath with CoreHaptics is combining the continuous type of CHHapticEvent with CHHapticParameterCurve.
A continuous event lets you say "hold a vibration for this many seconds." A parameter curve then controls how the intensity moves over that span, described by control points. For the inhale, ramp from 0 up slowly; for the exhale, fall from the peak back down to 0. That curve is the breathing wave.
Both intensity and sharpness take values from 0.0 to 1.0. Lowering sharpness rounds off the edges, giving a soft, gentle buzz. In a meditation app, keeping sharpness around 0.3 removes the stabbing quality and lets the haptic blend into the breath.
Here is one cycle of 4-7-8 breathing — inhale 4s, hold 7s, exhale 8s — assembled in Swift.
import CoreHaptics
func makeBreathPattern(inhale: Double, hold: Double, exhale: Double) throws -> CHHapticPattern {
let sharp = CHHapticEventParameter(parameterID: .hapticSharpness, value: 0.3)
// Inhale: continuous event ramping strength 0 -> 0.8
let inhaleEvent = CHHapticEvent(
eventType: .hapticContinuous,
parameters: [
CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.8),
sharp
],
relativeTime: 0,
duration: inhale)
let inhaleCurve = CHHapticParameterCurve(
parameterID: .hapticIntensityControl,
controlPoints: [
.init(relativeTime: 0, value: 0.0),
.init(relativeTime: inhale, value: 1.0)
],
relativeTime: 0)
// Exhale: continuous event falling 0.8 -> 0, offset by the hold
let exhaleStart = inhale + hold
let exhaleEvent = CHHapticEvent(
eventType: .hapticContinuous,
parameters: [
CHHapticEventParameter(parameterID: .hapticIntensity, value: 0.8),
sharp
],
relativeTime: exhaleStart,
duration: exhale)
let exhaleCurve = CHHapticParameterCurve(
parameterID: .hapticIntensityControl,
controlPoints: [
.init(relativeTime: exhaleStart, value: 1.0),
.init(relativeTime: exhaleStart + exhale, value: 0.0)
],
relativeTime: 0)
// The 7s hold has no event at all -- silence is the "hold your breath" phase
return try CHHapticPattern(
events: [inhaleEvent, exhaleEvent],
parameterCurves: [inhaleCurve, exhaleCurve])
}The crucial move is placing no event during the hold. The silence itself becomes the experience of holding your breath. Wrap two continuous events — inhale and exhale — in intensity curves, and the outline of a breath appears under the fingertips.