### Example: Playing Multiple Presets Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/kmp.mdx Demonstrates how to get all available presets and then play specific presets by their names. ```kotlin val presets = pulsar.getPresets() presets.play("Hammer") presets.play("DogBark") ``` -------------------------------- ### RealtimeComposer Example Usage Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/kmp.mdx A complete example showing how to get a RealtimeComposer, update haptics with `set`, play a discrete event, and stop playback. ```kotlin val realtime = pulsar.getRealtimeComposer() realtime.set(amplitude = 0.5f, frequency = 0.8f) realtime.set(amplitude = 1.0f, frequency = 0.3f) realtime.playDiscrete(amplitude = 0.7f, frequency = 0.5f) realtime.stop() ``` -------------------------------- ### Development Installation and Testing Source: https://github.com/software-mansion/pulsar/blob/main/animations/README.md Install the tool with development dependencies and run tests. This is for developers contributing to the project. ```bash pip install -e ".[dev]" pytest ``` -------------------------------- ### AdaptiveHaptics Example Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/kmp.mdx An example demonstrating the creation of an `AdaptivePreset` with both `Function` and `Pattern` configurations, and then using it to create and play haptics. ```kotlin import com.swmansion.pulsar.kmp.AdaptiveHaptics import com.swmansion.pulsar.kmp.AdaptivePreset import com.swmansion.pulsar.kmp.AdaptivePresetConfig import com.swmansion.pulsar.kmp.ConfigPoint import com.swmansion.pulsar.kmp.ContinuousPattern import com.swmansion.pulsar.kmp.PatternData import com.swmansion.pulsar.kmp.Pulsar val pulsar = Pulsar.create() val adaptivePreset = AdaptivePreset( ios = AdaptivePresetConfig.Function { presets -> presets.systemNotificationSuccess() }, android = AdaptivePresetConfig.Pattern( PatternData( continuousPattern = ContinuousPattern(amplitude = emptyList(), frequency = emptyList()), discretePattern = listOf( ConfigPoint(time = 0, amplitude = 1f, frequency = 0.5f), ConfigPoint(time = 150, amplitude = 0.6f, frequency = 0.4f), ), ), ), ) val haptics = pulsar.createAdaptiveHaptics(adaptivePreset) haptics.play() ``` -------------------------------- ### Run Flutter Example App Source: https://github.com/software-mansion/pulsar/blob/main/CONTRIBUTING.md Build and run the Flutter example application on a connected device or simulator. Navigate to the example app directory and execute the 'flutter run' command. ```bash cd flutter/PulsarApp flutter run # Build and run on a connected device/simulator ``` -------------------------------- ### Realtime Composer Set Example Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/flutter.mdx Demonstrates updating the ongoing haptic feedback with new amplitude and frequency values using the `set` method. This automatically starts playback if not already active. ```dart final realtime = pulsar.getRealtimeComposer(); await realtime.set(0.5, 0.8); await realtime.set(1.0, 0.3); await realtime.playDiscrete(0.7, 0.5); await realtime.stop(); ``` -------------------------------- ### Run React Native Example App Source: https://github.com/software-mansion/pulsar/blob/main/CONTRIBUTING.md Commands to run the React Native example application on iOS simulator or Android emulator. Requires navigating to the example app directory. ```bash cd react-native/PulsarApp npm run ios # iOS simulator npm run android # Android emulator ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/software-mansion/pulsar/blob/main/animations/example/README.md Run this command in your project directory to install all necessary npm packages. ```bash npm install ``` -------------------------------- ### Install and Generate Haptic Patterns Source: https://github.com/software-mansion/pulsar/blob/main/animations/README.md Install the tool and generate a haptic pattern from a Lottie file. You can also perform a dry run to see stats without generating output. ```bash pip install -e . pulsar-lottie tests/fixtures/bounce.json -o bounce.pulsar.json pulsar-lottie tests/fixtures/fade.json --dry-run cat bounce.pulsar.json ``` -------------------------------- ### Clone Pulsar Repo and Install Dependencies Source: https://github.com/software-mansion/pulsar/blob/main/figma/README.md Clone the Pulsar repository and install npm dependencies for the Figma plugin. This is the initial setup step. ```bash git clone --depth 1 https://github.com/software-mansion/pulsar.git ../pulsar npm install node scripts/build-preset-index.mjs ``` -------------------------------- ### Control Realtime Haptics Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/ios.mdx Example of using the RealtimeComposer to start, update, play discrete events, and stop haptics. ```swift let realtime = pulsar.getRealtimeComposer() // Start a continuous haptic realtime.set(amplitude: 0.5, frequency: 0.8) // Update parameters over time realtime.set(amplitude: 1.0, frequency: 0.3) // Play a one-off discrete event realtime.playDiscrete(amplitude: 0.7, frequency: 0.5) // Stop realtime.stop() ``` -------------------------------- ### Install React Native Pulsar Source: https://github.com/software-mansion/pulsar/blob/main/README.md Install the react-native-pulsar and react-native-worklets packages using npx. This is the initial setup step for React Native projects. ```bash npx expo install react-native-pulsar react-native-worklets ``` -------------------------------- ### Build and Run Documentation Site Source: https://github.com/software-mansion/pulsar/blob/main/CONTRIBUTING.md Start the development server or build a production version of the documentation site. Navigate to the docs directory and use npm commands. ```bash cd docs npm run dev # Start dev server ``` ```bash npm run build # Production build ``` -------------------------------- ### Example: Play Custom Haptic Pattern Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/kmp.mdx Demonstrates how to create a PatternData object with continuous and discrete haptic components and play it using the PatternComposer. This example shows defining amplitude and frequency over time. ```kotlin val composer = pulsar.getPatternComposer() val pattern = PatternData( continuousPattern = ContinuousPattern( amplitude = listOf( ValuePoint(time = 0, value = 0f), ValuePoint(time = 200, value = 1f), ValuePoint(time = 400, value = 0f), ), frequency = listOf( ValuePoint(time = 0, value = 0.3f), ValuePoint(time = 400, value = 0.8f), ) ), discretePattern = listOf( ConfigPoint(time = 0, amplitude = 1f, frequency = 0.5f), ConfigPoint(time = 100, amplitude = 0.5f, frequency = 0.5f), ) ) composer.playPattern(pattern) ``` -------------------------------- ### Example: Playing System Feedback Sounds Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/kmp.mdx Demonstrates how to access presets and play system-level feedback sounds like medium impact and success notifications. ```kotlin val presets = pulsar.getPresets() presets.systemImpactMedium() presets.systemNotificationSuccess() ``` -------------------------------- ### Install Pulsar Haptics Skill Source: https://github.com/software-mansion/pulsar/blob/main/iOS/Pulsar/README.md Install the pulsar-haptics skill using the plugin marketplace command or npx for command-line integration. ```text /plugin marketplace add software-mansion-labs/skills /plugin install skills@swmansion /reload-plugins ``` ```bash npx skills add software-mansion-labs/skills ``` -------------------------------- ### Install CocoaPods Dependencies (Initial) Source: https://github.com/software-mansion/pulsar/blob/main/react-native/PulsarApp/README.md Run this command using the Ruby bundler the first time you create a new project to install CocoaPods itself. ```sh bundle install ``` -------------------------------- ### Development Commands Source: https://github.com/software-mansion/pulsar/blob/main/figma/preview/README.md Provides essential commands for installing dependencies, running the development server, building the production version, and serving the production build locally. ```bash npm install # first time only npm run dev # Vite dev server on http://localhost:5173 npm run build # typecheck + production build → dist/ (base: './') npm run preview # serve the production build locally ``` -------------------------------- ### Example: Playing Multiple Presets by Name Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/flutter.mdx Demonstrates how to play specific sound presets like 'hammer' and 'dogBark' using their names after obtaining the presets instance. ```dart final presets = pulsar.getPresets(); await presets.play('hammer'); await presets.play('dogBark'); ``` -------------------------------- ### Check Haptic Support and Play Preset Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/kmp.mdx Example of checking the device's haptic compatibility and playing a preset if standard support is available. ```kotlin val pulsar = Pulsar.create() if (pulsar.hapticSupport() >= CompatibilityMode.STANDARD_SUPPORT) { pulsar.getPresets().dogBark() } ``` -------------------------------- ### Start Expo Development Server Source: https://github.com/software-mansion/pulsar/blob/main/animations/example/README.md Launches the Expo development server, providing options to open the app on various platforms and simulators. ```bash npx expo start ``` -------------------------------- ### Initialize Pulsar and Get Presets Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/android/presets-guide.md Instantiate the Pulsar library and retrieve the available haptic presets. This is the initial step before calling any preset methods. ```kotlin val pulsar = Pulsar(context) val presets = pulsar.getPresets() ``` -------------------------------- ### Start Metro Bundler Source: https://github.com/software-mansion/pulsar/blob/main/react-native/PulsarApp/README.md Run this command from the root of your React Native project to start the Metro JavaScript bundler. ```sh npm start ``` -------------------------------- ### Build and Install Android Pulsar SDK Source: https://github.com/software-mansion/pulsar/blob/main/CONTRIBUTING.md Commands to build the Pulsar Android Kotlin SDK and install the PulsarApp debug version. Requires navigating to the Android directory. ```bash cd Android ./gradlew :Pulsar:build ./gradlew :PulsarApp:installDebug ``` -------------------------------- ### Import Pulsar and Get Presets Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/ios/presets-guide.md Import the Pulsar library and obtain the PresetsWrapper object. This is the initial step before using any presets. ```swift import Pulsar let pulsar = Pulsar() let presets = pulsar.getPresets() ``` -------------------------------- ### Example: Playing System Feedback Sounds Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/flutter.mdx Demonstrates playing system-provided feedback sounds for medium impact and success notifications using the Pulsar presets instance. ```dart final presets = pulsar.getPresets(); await presets.systemImpactMedium(); await presets.systemNotificationSuccess(); ``` -------------------------------- ### PatternComposer Example Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/ios/api-overview.md Demonstrates how to create a PatternData object and use PatternComposer to parse and play haptic patterns. Useful for predefined, repeatable haptic sequences. ```swift import Pulsar let pulsar = Pulsar() let composer = pulsar.getPatternComposer() let pattern = PatternData( continuousPattern: ContinuousPattern( amplitude: [ ValuePoint(time: 0, value: 0.0), ValuePoint(time: 50, value: 1.0), ValuePoint(time: 300, value: 0.0), ], frequency: [ ValuePoint(time: 0, value: 0.3), ValuePoint(time: 300, value: 0.8), ] ), discretePattern: [ DiscretePoint(time: 0, amplitude: 1.0, frequency: 0.8), // crisp opening tap DiscretePoint(time: 100, amplitude: 0.5, frequency: 0.4), // softer follow-up DiscretePoint(time: 200, amplitude: 0.2, frequency: 0.2), // gentle close ] ) // Parse once, play many times composer.parsePattern(hapticsData: pattern) composer.play() // Or parse and play in one call composer.playPattern(hapticsData: pattern) ``` -------------------------------- ### Complete Integration Example for Checkout Screen Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/ios/api-overview.md Demonstrates a full integration of Pulsar within a UIViewController, including preset playback, real-time pattern manipulation, and custom pattern creation. ```swift import UIKit import Pulsar final class CheckoutViewController: UIViewController { // One Pulsar instance for the screen private let pulsar = Pulsar() private lazy var presets = pulsar.getPresets() private lazy var realtime = pulsar.getRealtimeComposer() override func viewDidLoad() { super.viewDidLoad() // Preload presets used in this screen pulsar.preloadPresets(presetNames: ["Stamp", "Buzz", "CoinDrop", "Wobble"]) } // MARK: - User actions @IBAction func confirmOrderTapped(_ sender: UIButton) { presets.stamp() submitOrder() } @IBAction func cancelTapped(_ sender: UIButton) { presets.latch() dismiss(animated: true) } // MARK: - Outcomes func handleOrderSuccess() { presets.coinDrop() showSuccessBanner() } func handleOrderFailure(message: String) { presets.buzz() showErrorAlert(message: message) } func handleValidationError() { presets.wobble() highlightInvalidFields() } // MARK: - Slider with real-time haptics @IBAction func amountSliderChanged(_ sender: UISlider) { let amplitude = sender.value // 0–1 realtime.set(amplitude: amplitude, frequency: 0.5) } @IBAction func amountSliderEnded(_ sender: UISlider) { realtime.stop() presets.ping() } // MARK: - Custom pattern func playCustomConfirmation() { let composer = pulsar.getPatternComposer() let pattern = PatternData( continuousPattern: ContinuousPattern( amplitude: [ ValuePoint(time: 0, value: 0.0), ValuePoint(time: 100, value: 0.8), ValuePoint(time: 300, value: 0.0), ], frequency: [ ValuePoint(time: 0, value: 0.4), ValuePoint(time: 300, value: 0.7), ] ), discretePattern: [ DiscretePoint(time: 0, amplitude: 1.0, frequency: 0.8), DiscretePoint(time: 150, amplitude: 0.4, frequency: 0.3), ] ) composer.playPattern(hapticsData: pattern) } } ``` -------------------------------- ### Install Pulsar AI Skill via npx Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/skills.mdx Install the Pulsar AI skill using the `npx` command. This is an alternative method for adding the skill to your project. ```bash npx skills add software-mansion-labs/skills ``` -------------------------------- ### Play Standard Haptic Presets Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/android/presets-guide.md Examples of invoking common cross-platform haptic feedback patterns provided by Pulsar. Use these for consistent haptic experiences across different platforms. ```kotlin presets.fanfare() presets.coinDrop() presets.buzz() ``` -------------------------------- ### Check Haptic Support and Play Preset Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/flutter.mdx Example of checking if the device has standard or advanced haptic support before attempting to play a preset haptic event like 'dogBark'. ```dart final pulsar = Pulsar(); if ((await pulsar.hapticSupport()).index >= HapticSupport.standardSupport.index) { await pulsar.getPresets().dogBark(); } ``` -------------------------------- ### Repository Structure Source: https://github.com/software-mansion/pulsar/blob/main/CONTRIBUTING.md Overview of the Pulsar project's directory layout, showing the organization of native SDKs, cross-platform bridges, example apps, and documentation. ```bash pulsar/ ├── iOS/ │ ├── Pulsar/ # iOS Swift SDK (Swift Package, iOS 13+) │ └── PulsarApp/ # iOS native demo app (Xcode project) ├── Android/ │ ├── Pulsar/ # Android Kotlin SDK (Gradle library) │ └── PulsarApp/ # Android native demo app (Gradle project) ├── react-native/ │ ├── react-native-pulsar/ # React Native Turbo Module │ │ ├── src/ # TypeScript API │ │ ├── ios/ # ObjC/Swift bridge │ │ └── android/ # Kotlin bridge layer │ └── PulsarApp/ # React Native example app ├── flutter/ │ ├── pulsar/ # Flutter plugin (Dart API + iOS/Android bridge) │ └── PulsarApp/ # Flutter example app ├── PulsarApp/ # React Native Expo showcase app └── docs/ # Astro/Starlight documentation site ``` -------------------------------- ### Run React Native Expo Showcase App Source: https://github.com/software-mansion/pulsar/blob/main/CONTRIBUTING.md Commands to build and run the React Native Expo showcase app on iOS or Android, or to start the Metro bundler. ```bash cd PulsarApp npm run ios # Build and run on iOS npm run android # Build and run on Android npm run start # Start Metro bundler ``` -------------------------------- ### Install Pulsar for Expo and npm Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/react-native/migration.md Install `react-native-pulsar` and `react-native-worklets`. For Expo projects, run `npx expo install` and `npx expo prebuild`. For npm projects, use `npm install`. ```bash # Expo npx expo install react-native-pulsar npx expo prebuild # npm npm install react-native-pulsar react-native-worklets ``` -------------------------------- ### Reset Project to Starter Code Source: https://github.com/software-mansion/pulsar/blob/main/animations/example/README.md Resets the project by moving starter code to 'app-example' and creating a blank 'app' directory for new development. ```bash npm run reset-project ``` -------------------------------- ### Install React Native Pulsar with Expo Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/react-native.mdx Install the react-native-pulsar package using Expo. After installation, run prebuild to generate native project files. ```bash npx expo install react-native-pulsar ``` ```bash npx expo prebuild ``` -------------------------------- ### Initialize and Use Pulsar with Haptics Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/kmp.mdx Demonstrates initializing Pulsar, preloading presets, checking haptic compatibility, playing a preset, and disabling haptics. ```kotlin val pulsar = Pulsar.create() pulsar.preloadPresets(listOf("Hammer", "DogBark")) if (pulsar.canPlayHaptics()) { pulsar.getPresets().play("Hammer") } pulsar.enableHaptics(false) ``` -------------------------------- ### Install CocoaPods Dependencies (Updates) Source: https://github.com/software-mansion/pulsar/blob/main/react-native/PulsarApp/README.md After updating native dependencies, run this command to install or update CocoaPods. ```sh bundle exec pod install ``` -------------------------------- ### Install Pulsar with CocoaPods Source: https://github.com/software-mansion/pulsar/blob/main/iOS/Pulsar/README.md Integrate Pulsar into your iOS project by adding the 'Pulsar-haptics' pod to your Podfile and running 'pod install'. ```ruby pod 'Pulsar-haptics', '~> 1.1.2' ``` -------------------------------- ### Install All JS/TS Dependencies Source: https://github.com/software-mansion/pulsar/blob/main/CONTRIBUTING.md Installs all JavaScript and TypeScript dependencies for the PulsarApp, React Native library, and documentation from the repository root. ```bash npm run install:all ``` -------------------------------- ### Get and Use Pulsar Presets Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/ios.mdx Demonstrates how to retrieve all available sound presets from Pulsar and invoke a specific preset like 'dogBark()'. Ensure the Pulsar SDK is initialized before use. ```swift let presets = pulsar.getPresets() presets.dogBark() ``` -------------------------------- ### Startup Preloading of Haptic Presets Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/ios/api-overview.md Preload common haptic presets at application launch to ensure they are available without delay. ```swift // AppDelegate or @main App struct func applicationDidFinishLaunching(_ application: UIApplication) { pulsar.preloadPresets(presetNames: [ "Ping", // list selection "Stamp", // dialog confirm "Buzz", // error/reject "Fanfare", // achievement ]) } ``` -------------------------------- ### Install React Native Pulsar with npm Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/react-native.mdx Install the react-native-pulsar and react-native-worklets packages using npm. Ensure you have the New Architecture enabled for React Native. ```bash npm install react-native-pulsar react-native-worklets ``` -------------------------------- ### Install Pulsar AI Skill via Plugin Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/skills.mdx Use these commands to add the Pulsar AI skill as a plugin to your project. Ensure you reload plugins after installation. ```text /plugin marketplace add software-mansion-labs/skills /plugin install skills@swmansion /reload-plugins ``` -------------------------------- ### Create Adaptive Haptics Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/kmp.mdx Initializes AdaptiveHaptics with a cross-platform `AdaptivePreset`. This allows for platform-specific haptic configurations. ```kotlin val haptics = pulsar.createAdaptiveHaptics(preset) ``` -------------------------------- ### Preload and Play Haptics with Settings Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/flutter.mdx Demonstrates preloading haptic presets, checking if haptics can play, playing a specific preset, and disabling haptics. ```dart final pulsar = Pulsar(); await pulsar.preloadPresets(['hammer', 'dogBark']); if (await pulsar.canPlayHaptics()) { await pulsar.getPresets().play('hammer'); } await pulsar.enableHaptics(false); ``` -------------------------------- ### Epiphany Pattern Source: https://github.com/software-mansion/pulsar/blob/main/web/Pulsar/presets-gallery.html Starts with hesitant ticks, accelerates into realization, and culminates in a climactic warmth. ```javascript { name: "epiphany", category: "Wild", description: "Hesitant ticks, accelerating realization, climactic warmth.", pattern: [ c(0, 30), c(800, 30), c(1500, 30), c(2000, 30), c(2300, 30), c(2500, 30), c(2650, 30), c(2750, 30), c(2820, 30), c(2900, 200), p(3120, 1200, 0.4, 0.18), ] } ``` -------------------------------- ### Conditional Haptic Playback Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/react-native.mdx Example of playing a preset only if the device supports standard or advanced haptics. ```typescript import { Settings, HapticSupport, Presets } from 'react-native-pulsar'; const support = Settings.getHapticsSupportLevel(); if (support >= HapticSupport.STANDARD_SUPPORT) { Presets.dogBark(); } ``` -------------------------------- ### Get Realtime Composer Instance Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/ios.mdx Obtain the shared instance of the RealtimeComposer for live haptic control. ```swift let realtime = pulsar.getRealtimeComposer() ``` -------------------------------- ### Initial Render and Load Log Source: https://github.com/software-mansion/pulsar/blob/main/web/Pulsar/presets-gallery.html Performs the initial rendering of the preset gallery and logs summary information about loaded presets, categories, and restored votes. ```javascript render(); const votedCount = Object.values(votes).filter((v) => Number.isFinite(v) && v !== 0).length; log(`Loaded ${PRESETS.length} presets across ${categories.length} categories. Restored votes for ${votedCount} preset(s).`); ``` -------------------------------- ### Get Haptic Presets Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/ios.mdx Access the collection of ready-to-use haptic patterns provided by the Pulsar SDK. ```swift let presets = pulsar.getPresets() ``` -------------------------------- ### Setup ESLint for Linting Source: https://github.com/software-mansion/pulsar/blob/main/animations/example/README.md Command to set up ESLint for code linting within your Expo project. ```bash npx expo lint ``` -------------------------------- ### Get Haptic Support Level Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/android/api-overview.md Returns the `CompatibilityMode` for the current device, indicating its haptic support level. ```kotlin pulsar.hapticSupport() ``` -------------------------------- ### Get RealtimeComposer Instance Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/android/api-overview.md Retrieve the RealtimeComposer instance from Pulsar. This can be done with a default strategy or an explicitly specified one. ```kotlin val realtime = pulsar.getRealtimeComposer() // Or with an explicit strategy: val realtime = pulsar.getRealtimeComposer( strategy = RealtimeComposerStrategy.PRIMITIVE_COMPLEX ) ``` -------------------------------- ### Play System Haptic Preset by Name Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/ios.mdx Demonstrates playing haptic presets directly by their method name or by retrieving them by string name and then calling play. This allows for dynamic selection of haptic feedback. ```swift let presets = pulsar.getPresets() // Direct call presets.dogBark() // By name presets.getByName("Success")?.play() ``` -------------------------------- ### Nature Presets for Pulsar Source: https://github.com/software-mansion/pulsar/blob/main/web/Pulsar/presets-gallery.html Examples of nature-inspired haptic patterns including plant growth, flower blooming, and seed falling. ```javascript { name: "leavesGrowing", category: "Nature", description: "Slow gentle stretch — a sprout reaching up.", pattern: [p(0, 2000, 0.4, 0.1)] } ``` ```javascript { name: "flowerBloom", category: "Nature", description: "Soft swelling expansion of opening petals.", pattern: [p(0, 1600, 0.5, 0.18)] } ``` ```javascript { name: "seedFall", category: "Nature", description: "Single light drop.", pattern: [c(0, 22)] } ``` -------------------------------- ### AdaptivePreset Configuration Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/kmp.mdx Defines how haptics are configured for different platforms. Use `Function` for callbacks or `Pattern` for custom `PatternData`. ```kotlin sealed class AdaptivePresetConfig { class Function(val play: (PulsarPresets) -> Unit) : AdaptivePresetConfig() class Pattern(val pattern: PatternData) : AdaptivePresetConfig() } ``` -------------------------------- ### Get Realtime Composer Source: https://github.com/software-mansion/pulsar/blob/main/docs/src/content/docs/sdk/flutter.mdx Obtain the RealtimeComposer instance from the Pulsar object. This composer allows for live control of haptic feedback. ```dart final realtime = pulsar.getRealtimeComposer(); ``` -------------------------------- ### Using Presets Source: https://github.com/software-mansion/pulsar/blob/main/skills/references/react-native/api-overview.md Presets offer a straightforward way to integrate haptic feedback. You can import `Presets` and directly invoke any of the named functions. These functions are synchronous, worklet-compatible, and do not require any parameters. ```APIDOC ## Using Presets ### Description Presets are the simplest way to add haptics. Import `Presets` and call any named function directly. All preset functions are synchronous (no `await`), worklet-compatible, and take no parameters. ### Methods - `Presets.ping()` - `Presets.fanfare()` - `Presets.buzz()` - `Presets.stamp()` ### Usage Example ```ts import { Presets } from 'react-native-pulsar'; // In a React event handler