tangent_haptic_feedback library

A powerful, type-safe haptic feedback library for iOS. Android Coming soon!

TangentHapticFeedback provides a pattern-based API for creating rich haptic experiences using iOS Core Haptics.

Quick Start

import 'package:tangent_haptic_feedback/tangent_haptic_feedback.dart';

// Play a built-in pattern
await TangentHapticFeedback.play(HapticPatterns.success);

// Create a custom pattern
final pattern = HapticPatternBuilder()
  .tap(intensity: 0.8)
  .waitMs(50)
  .tap(intensity: 1.0)
  .build();
await TangentHapticFeedback.play(pattern);

Key Concepts

  • HapticEvent: A single haptic unit (transient tap or continuous rumble)
  • HapticPattern: A sequence of events that can be played together
  • HapticParam: A parameter that can be constant or vary over time (curves)
  • HapticPatterns: Built-in pattern library for common use cases

Classes

ConstantParam
Constant parameter value.
ContinuousEvent
A sustained haptic (rumble, vibration) with constant parameters.
CurveParam
Custom curve parameter with multiple control points.
HapticEvent
Base type for all haptic events.
HapticParam
Represents a haptic parameter (intensity or sharpness) that can be constant or vary over time using curves.
HapticPattern
An immutable sequence of haptic events.
HapticPatternBuilder
A builder for creating haptic patterns fluently.
HapticPatterns
Built-in haptic pattern library.
LinearParam
Linear interpolation parameter.
TangentHapticFeedback
Main API for playing haptic feedback patterns.
TransientEvent
A sharp, instantaneous haptic (tap, click, impact).