MaratGilyazov
MaratGilyazov/def_taptic_engine/taptic_engine
Haptic feedback through the iOS Taptic Engine: impact, notification and selection events.
- GitHub: MaratGilyazov/def_taptic_engine — pinned to
v1.2- Pick a release from MaratGilyazov/def_taptic_engine releases and add its Source code (zip) URL (or a packaged
.zipasset, if the library ships one) togame.projectunder[project]dependencies, then Fetch Libraries in the Defold editor. - Run
bunx @defold-typescript/cli resolveto materialize its types. - Import it under a namespace alias of your choice:
import * as taptic_engine from "taptic_engine"
- Pick a release from MaratGilyazov/def_taptic_engine releases and add its Source code (zip) URL (or a packaged
Functions
isSupported(): boolean
Reports whether the device supports the Taptic Engine.
Returns
boolean—truewhen haptic feedback is available.
impact(style: number)
Plays an impact haptic.
Parameters
style:number— One ofIMPACT_LIGHT,IMPACT_MEDIUMorIMPACT_HEAVY.
notification(type: number)
Plays a notification haptic.
Parameters
type:number— One ofNOTIFICATION_SUCCESS,NOTIFICATION_WARNINGorNOTIFICATION_ERROR.
selection()
Plays a selection-change haptic.
Variables
IMPACT_LIGHT: number
Light impact style, for {@link taptic_engine.impact}.
IMPACT_MEDIUM: number
Medium impact style, for {@link taptic_engine.impact}.
IMPACT_HEAVY: number
Heavy impact style, for {@link taptic_engine.impact}.
NOTIFICATION_SUCCESS: number
Success notification type, for {@link taptic_engine.notification}.
NOTIFICATION_WARNING: number
Warning notification type, for {@link taptic_engine.notification}.
NOTIFICATION_ERROR: number
Error notification type, for {@link taptic_engine.notification}.