Haptic Engine

📱 Testing on this page: "Test" only produces real vibration on devices/browsers that support the Web Vibration API — mainly Android Chrome/Firefox. iOS Safari does not expose vibration to web pages; use the iOS integration code in each card's Link/README for native apps.

📳 Haptic Pattern Presets

Each pattern mirrors a matching sound in the Audio Engine, so touch and sound feedback stay consistent across the product.

Xcojo Signature

Four-pulse rising pattern — Xcojo's signature haptic, paired with the Signature sound.

Xcojo Notification

Clean 2-pulse rising tap — default haptic for standard system and in-app notifications.

Light Tap

Single short, low-intensity pulse for minor UI feedback (matches Glass Tap sound).

Selection Change

Very light tick for scrolling through options, pickers, or tabs.

Success

Two soft pulses confirming a completed action (matches Crystal Shimmer sound).

Warning

Soft double-buzz for non-urgent cautions (matches Velvet Caution sound).

Error

Sharp triple-buzz for failed actions or validation errors.

Heavy Impact

Single strong pulse for major or destructive actions (matches Tactile Switch sound).

Soft Pulse

Gentle dual pulse for passive notifications that shouldn't interrupt (matches Velvet Pulse sound).

🎛️ Custom Pattern Builder

Build a pulse sequence: add a pulse duration, then a gap, alternating, to design a custom pattern.

No pulses added yet. Set a duration and gap, then click "Add Pulse".

📋 Your Custom Pattern Code


                    

README & Developer Guide

Welcome to the Xcojo Haptic Engine & API. This service provides centralized haptic pattern definitions across all xcojo.com properties and native apps, kept in sync with the Audio Engine's sound presets.

API Endpoint & Parameters

Available Presets

Response Shape

Each request returns JSON with three platform representations of the same pattern:

{
  "status": "success",
  "pattern": "notification",
  "label": "Xcojo Notification",
  "web": [25, 50, 35],
  "ios": {
    "type": "impact",
    "style": "light",
    "repeat": 2,
    "note": "UIImpactFeedbackGenerator(style: .light) then .medium ~85ms later"
  },
  "android": {
    "timings": [0, 25, 50, 35],
    "amplitudes": [0, 110, 0, 190]
  }
}

Web Integration (Vibration API)

Supported on Android Chrome/Firefox. Not supported on iOS Safari or desktop browsers.

fetch('https://dev.xcojo.com/Haptic/?pattern=notification')
    .then(r => r.json())
    .then(data => {
        if (navigator.vibrate) {
            navigator.vibrate(data.web);
        }
    });

iOS Integration (Swift)

// Example for "impact" type patterns
let generator = UIImpactFeedbackGenerator(style: .light)
generator.prepare()
generator.impactOccurred()

// Example for "notification" type patterns
let notifGenerator = UINotificationFeedbackGenerator()
notifGenerator.notificationOccurred(.success)

// Example for "selection" type patterns
let selectionGenerator = UISelectionFeedbackGenerator()
selectionGenerator.selectionChanged()

Android Integration (Kotlin)

val timings = longArrayOf(0, 25, 50, 35)
val amplitudes = intArrayOf(0, 110, 0, 190)
val effect = VibrationEffect.createWaveform(timings, amplitudes, -1)
vibrator.vibrate(effect)

Cross-Origin Integration (CORS)

All endpoints include automatic CORS headers (Access-Control-Allow-Origin: *) enabling cross-domain usage.

Copied!