Dunfey · Hotel WWDC as data, est. 1983
Front desk everything
Years
Topics

2021 DesignGraphics & GamesSpatial ComputingAudio & Video

WWDC21 · 16 min · Design / Graphics & Games / Spatial Computing / Audio & Video

Practice audio haptic design

Discover how you can deliver rich app experiences that include animation, sound, and haptics on iPhone. Learn key concepts for designing multimodal experiences within the Core Haptics framework. We’ll take you through our sample HapticRicochet app — where haptic and sound feedback is designed in harmony with key interactive moments — and show you how to create magical and delightful experiences. To get the most out of this session, we recommend first watching “Expanding the Sensory Experience with Core Haptics” from WWDC19, and checking out the HapticBounce sample project (which requires Xcode, iPhone 8 or newer, and a basic knowledge of Swift). Familiarity with Core Haptics is helpful, but not required.

Watch at developer.apple.com ↗

Transcript all transcripts

Code shown on screen · 1 snippet

Shield swift · at 8:05 ↗
// Initialize shield.
func initializeShieldHaptics() {
    // Create a pattern from the shield asset.
    let pattern = createPatternFromAHAP("ShieldTransient")!
        
    // Create a player from the shield pattern.
    shieldPlayer = try? engine.makePlayer(with: pattern)
}

/ Play shield transformation.
func shield() {
    // …
    // start player for haptics and audio.
    startPlayer(shieldPlayer)
        
    // Play shield animation
    isAnimating = true
    sphereView.layer.add(shieldAnimation, forKey: "Width")
    // …
}

Resources