{"id":36419313,"url":"https://github.com/xfqwdsj/multihaptic","last_synced_at":"2026-01-17T12:56:13.985Z","repository":{"id":305731504,"uuid":"1019712595","full_name":"xfqwdsj/multihaptic","owner":"xfqwdsj","description":"A Kotlin multiplatform library for haptic feedback across multiple platforms.","archived":false,"fork":false,"pushed_at":"2025-12-16T22:41:33.000Z","size":180,"stargazers_count":7,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-11T18:38:05.233Z","etag":null,"topics":["android","compose-multiplatform","haptic-feedback","haptics","kotlin","kotlin-library","kotlin-multiplatform"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xfqwdsj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-14T18:48:58.000Z","updated_at":"2025-12-20T10:04:45.000Z","dependencies_parsed_at":"2025-10-06T16:14:03.931Z","dependency_job_id":"2c5a74f9-b30e-483c-85a3-a1ac5e4af69f","html_url":"https://github.com/xfqwdsj/multihaptic","commit_stats":null,"previous_names":["xfqwdsj/multihaptic"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/xfqwdsj/multihaptic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfqwdsj%2Fmultihaptic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfqwdsj%2Fmultihaptic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfqwdsj%2Fmultihaptic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfqwdsj%2Fmultihaptic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xfqwdsj","download_url":"https://codeload.github.com/xfqwdsj/multihaptic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xfqwdsj%2Fmultihaptic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28508832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T11:50:55.898Z","status":"ssl_error","status_checked_at":"2026-01-17T11:50:55.569Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","compose-multiplatform","haptic-feedback","haptics","kotlin","kotlin-library","kotlin-multiplatform"],"created_at":"2026-01-11T17:02:49.632Z","updated_at":"2026-01-17T12:56:13.951Z","avatar_url":"https://github.com/xfqwdsj.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# multihaptic\n\n![Maven Central Version](https://img.shields.io/maven-central/v/top.ltfan.multihaptic/multihaptic-core) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/xfqwdsj/multihaptic)\n\nA Kotlin multiplatform library for haptic feedback across multiple platforms.\n\n## Getting Started\n\nThe `multihaptic` library contains these modules:\n\n- `multihaptic-core`: Core functionality for haptic feedback.\n- `multihaptic-compose`: Haptic feedback support for Compose.\n- `multihaptic-platform-dsl`: Platform-specific DSL for haptic feedback.\n\nTo use `multihaptic` in your Kotlin Multiplatform project, add the following dependency to your `build.gradle.kts` file:\n\n```kotlin\ndependencies {\n    implementation(\"top.ltfan.multihaptic:multihaptic-core:\u003cversion\u003e\") // Not needed if you add the Compose dependency\n    implementation(\"top.ltfan.multihaptic:multihaptic-compose:\u003cversion\u003e\") // For Compose support\n\n    implementation(\"top.ltfan.multihaptic:multihaptic-platform-dsl:\u003cversion\u003e\") // If you want to use the DSLs to build the haptic effects\n}\n```\n\nOr if you are using Gradle Version Catalogs, add the following to your `gradle/libs.versions.toml`:\n\n```toml\n[versions]\nmultihaptic = \"\u003cversion\u003e\"\n\n[libraries]\nmultihaptic = { module = \"top.ltfan.multihaptic:multihaptic-core\", version.ref = \"multihaptic\" }\nmultihaptic-compose = { module = \"top.ltfan.multihaptic:multihaptic-compose\", version.ref = \"multihaptic\" }\nmultihaptic-platformDsl = { module = \"top.ltfan.multihaptic:multihaptic-platform-dsl\", version.ref = \"multihaptic\" }\n```\n\nMake sure your `settings.gradle.kts` includes the repository:\n\n```kotlin\ndependencyResolutionManagement {\n    repositories {\n        mavenCentral()\n    }\n}\n```\n\n## Features\n\n### Predefined Haptic Effects (Core)\n\nInspired by Android's\n[`VibrationEffect.Composition`](https://developer.android.com/reference/kotlin/android/os/VibrationEffect.Composition),\n`multihaptic` provides a set of predefined haptic effects that can be used across platforms.\n\nYou can create predefined haptic effects by following this example:\n\n```kotlin\nHapticEffect {\n    predefined(PrimitiveType.Click) {\n        scale = .5f // Adjust the intensity of the click\n    }\n    predefined(PrimitiveType.Thud) {\n        scale = .8f // Adjust the intensity of the thud\n        delay = 100.milliseconds // Delay before the thud effect\n        delayType = DelayType.Pause // 100 milliseconds pause after the previous effect\n    }\n    predefined(PrimitiveType.Tick) {\n        scale = .3f // Adjust the intensity of the tick\n        delay = 50.milliseconds // Delay before the tick effect\n        delayType = DelayType.RelativeStartOffset // 50 milliseconds relative to the start of the previous effect\n    }\n    lowTick {\n        delay = 30.milliseconds\n    }\n    quickRise // With default parameters\n}\n```\n\n### Custom Haptic Effects (Core)\n\nYou can also create custom haptic effects:\n\n```kotlin\nHapticEffect {\n    custom {\n        fallback = PrimitiveType.Spin\n        // or\n        spinFallback\n\n        curves {\n            intensity {\n                0f at 0.milliseconds // Start with no intensity\n                1f at 5.milliseconds // Increase to full intensity\n                0f at 10.milliseconds // Decrease back to no intensity\n            }\n            sharpness {\n                .3f at 0.milliseconds // Start with low sharpness\n            }\n        }\n    }\n}\n```\n\n### Compose Support (Compose)\n\nThe `multihaptic-compose` module provides support for haptic feedback in Compose Multiplatform applications. You can use\nthe `rememberVibrator` from a Composable function to get a `Vibrator` instance and trigger haptic effects.\n\n## Platforms\n\n| Platform                            | Predefined Effects | Advanced Custom Effects | Details                                                                              |\n|-------------------------------------|--------------------|-------------------------|--------------------------------------------------------------------------------------|\n| Android                             | ✅ Supported        | ✅ Supported             | Uses multiple vibration API; advanced composition/custom effects depend on API level |\n| iOS (CoreHaptics, 13.0+)            | ✅ Supported        | ✅ Supported             | Core Haptics for complex custom effects                                              |\n| iOS (UIKit, 10.0+)                  | ✅ Supported        | 🚫 Fallback             | UIFeedbackGenerator for predefined feedback only                                     |\n| macOS (CoreHaptics/Catalyst, 13.0+) | ✅ Supported        | ✅ Supported             | Core Haptics available for Mac Catalyst apps                                         |\n| macOS (AppKit, 10.11+)              | ✅ Supported        | 🚫 Fallback             | AppKit Haptic Feedback, only preset effects                                          |\n| watchOS                             | ✅ Supported        | 🚫 Fallback             | WatchKit haptic types, mapped to predefined effects                                  |\n| tvOS (14.0+)                        | ✅ Supported        | ✅ Supported             | Core Haptics if available                                                            |\n| Browser (Web/Js/Wasm)               | ✅ Supported        | 🚫 Fallback             | Web Vibration API, only duration-based vibration                                     |\n| Windows                             | 🚫 No effect       | 🚫 No effect            |                                                                                      |\n| Linux                               | 🚫 No effect       | 🚫 No effect            |                                                                                      |\n\n**Note:**\n\n- Advanced custom effects require Core Haptics (Apple) or high Android API level.\n- Browsers only support basic vibration, not custom curves.\n- If predefined effects are supported but advanced custom effects are not, the library will use the predefined effects\n  as a fallback.\n\n## Contributing\n\nWe welcome contributions! Please submit issues or pull requests for any bugs, features, or improvements.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxfqwdsj%2Fmultihaptic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxfqwdsj%2Fmultihaptic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxfqwdsj%2Fmultihaptic/lists"}