Touch Events

Adds tap, drag and swipe controls, so you touch the screen to control the Lens. Say what each touch does, for example tap to drop a coin.

Camera, Audio & Sensors

Camera feed, hand and face tracking, touch, tilt, haptics, and sound.

Made with this block

Inputs

blockDefaultTouchesboolean

Set this to true when you intend to have swipe behavior in the lens, like dragging an object, swiping, or pinching to zoom, or for lenses with double taps so as to prevent these gestures from accidentally triggering the snapchat UI.

allowDoubleTapboolean

Set this to false by default to prevent unintended camera switching. Only set this to true if you have blockDefaultTouches enabled and you explicitly want to allow Snapchat’s default double-tap behavior (switching between device cameras). If your experience uses double tap as part of its own interaction design, keep this set to false to avoid accidentally triggering the Snapchat camera swap.

enableHintboolean

Shows a system hint (on screen instruction) for the relevant interaction for touch events, true by default unless the lens shows it's own hint through text or another means.

Events

onDoubleTap

Double Tap event (two consecutive taps on the screen). If this is used, don't allowDoubleTap.

onTouchDown

Triggered when the user touches the screen.

onTouchMove

Triggered when the user moves a finger on the screen.

onTouchUp

Triggered when the user lifts a touch from screen. Touch ends.

onTap

Triggers on tap