Haptics

Haptics engage people’s sense of touch to enhance the experience of interacting with onscreen interfaces. For example, when an Apple Pay transaction is confirmed, the system plays haptics in addition to providing visual and auditory feedback. Haptics can also enhance touch gestures and interactions like scrolling through a picker or toggling a switch.

On supported iPhone models, you can add haptics to your app in several ways.

Use standard UI elements—like switches, sliders, and pickers—that play Apple-designed system haptics by default.
When it makes sense, use a feedback generator to play one of several predefined haptic patterns in the categories of notification, impact, and selection. For developer guidance, see UIFeedbackGenerator.
In situations where you want more control, compose and play your own haptic patterns. For guidance, see Creating Custom Haptic Patterns.

When you use system haptics, iOS manages the strength and behavior of the feedback. For example, a switch automatically plays a subtle tap and a feedback generator for the “success” notification plays the pattern shown below. (For developer guidance, see Animation and Haptics.)

Play

Success. Indicates that a task or action, such as depositing a check or unlocking a vehicle, has completed.

Notification
Success
Warning
Failure
Impact
Light
Medium
Heavy
Rigid
Soft
Selection
Selection

Whether you use system-provided haptics or create your own, it’s crucial to use haptics in ways that enrich the user experience without distracting people from their goals.
Designing with Haptics

Designing interfaces that engage people’s sense of touch can bring their familiarity with the physical world into your app. Regardless of how you produce the haptics in your app, the following guidelines can help you give people a cohesive and compelling experience.

Build a clear, causal relationship between each haptic and its trigger. Ideally, people always know why your app plays a haptic pattern. If a haptic doesn’t reinforce a cause-and-effect relationship, it can be confusing and seem gratuitous.

Use haptics in ways that complement other feedback in your app. When your app’s visual, auditory, and tactile feedback are in harmony—as they are in the physical world—the user experience is more coherent and can seem more natural.

Use haptics judiciously. For example, use haptics when they provide long-lasting value; using them to add novelty can make your app feel gimmicky. Also, prefer adding haptics to a small number of significant, consequential interactions. Playing haptics for a large number of trivial interactions can overwhelm people.

Use haptics consistently. Consistency in haptic feedback helps people develop tactile associations between certain haptic patterns and certain experiences. For example, if your app plays a specific haptic pattern when a game character fails to finish a mission, people learn to associate that pattern with a negative outcome. If you use the same haptic pattern for a positive outcome like a level completion, people will be confused.

Avoid overusing a haptic. Sometimes a haptic can feel just right when experienced occasionally, but become tiresome when it’s experienced frequently. In general, avoid designing an experience that yields extended or repetitive haptic feedback. Often, the best haptic experience is one that people may not be conscious of, but miss when it’s turned off.

Be sure to test the haptics in your app. Different people have different preferences and levels of sensitivity to haptics, so you need to test the haptics with as many people as possible.

Make haptics optional. Let people turn off or mute haptics if they wish, and make sure people can still enjoy your app without them.

In a game, consider ways to use custom haptics to enhance the player’s experience. In addition to playing haptics when players interact with items and controls, you might want to play haptics that help communicate in-game events. For example, haptics could enhance substantial experiences—like a collision or a hit—or subtle experiences—like the approach of footsteps or a looming danger.

Be conscious that playing haptics might impact other user experiences. By design, haptics produce enough physical force for people to feel the device vibrate. Ensure that haptics don’t disrupt user experiences involving the camera, gyroscope, or microphone.
Creating Custom Haptic Patterns

A custom haptic pattern can represent things like releasing a slingshot or driving over a rumble strip. Custom patterns can also vary dynamically, based on user input or context. For example, the impact players feel when a game character jumps from a tree can be stronger than when the character jumps in place.

In iOS 13 and later, Core Haptics provides two basic building blocks that generate custom haptic patterns:

Transient events, which are brief, compact experiences that feel like taps or impulses, such as the experience of tapping the Flashlight button on the Home screen
Continuous events, which feel like sustained vibrations, such as the experience of the lasers effect in a message

Regardless of the building block you choose to generate a custom haptic, you can also control its sharpness and intensity.

Drawing of two blue disks. The left disk represents a high degree of sharpness by using a solid blue fill and a distinct outer edge. The right disk represents a low degree of sharpness by using a blue fill that fades to white as it gets closer to the edge. The right disk doesn’t have a discernible edge.

Sharpness

Drawing of two sets of concentric circles each emanating from a small blue disk. All circles in the left set are drawn with a consistent shade of blue and represent high intensity. The circles in the right set represent low intensity and are drawn with shades of blue that get lighter as the circles get farther from the center.

Intensity

You can think of sharpness as a way to abstract a haptic experience into the waveform that produces the corresponding physical sensations. Specifying sharpness lets you relay to the system your intent for the experience. For example, you might use sharpness values to convey an experience that’s soft, rounded, or organic, or one that’s crisp, precise, or mechanical. As the term implies, intensity means the strength of the haptic.

By combining transient and continuous events, varying sharpness and intensity, and including optional audio content, you can create a wide range of different haptic experiences. For developer guidance, see Core Haptics.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值