Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
土掘るHaptics
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
cffYoHa
October 21, 2025
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
土掘るHaptics
potatotips #93 iOS/Android開発Tips共有会
cffYoHa
October 21, 2025
More Decks by cffYoHa
See All by cffYoHa
Grid表示のレイアウトで Flow layoutsを使う
cffyoha
1
420
Other Decks in Programming
See All in Programming
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
490
Jetpack Compose Mechanisms
skydoves
2
720
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
390
Simple Storage Service(S3) is not simple
iwatsukayura
0
270
ジョジョの世界をXRで再現する
mofurune
0
150
自サークルのIdPからログアウトできるようになるまで
taiseiue
1
130
R8 の設定見直しでアプリサイズ削減
andpad
0
210
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
330
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
570
Agents on Rails - Rails at Scale 2026
irinanazarova
0
530
Verilogで学ぶCPU自作入門
uyuki234
8
4.1k
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
5
5.1k
Featured
See All Featured
Ethics towards AI in product and experience design
skipperchong
2
420
Into the Great Unknown - MozCon
thekraken
41
2.8k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
710
Fireside Chat
paigeccino
43
4.1k
Building Applications with DynamoDB
mza
96
7.2k
Speed Design
sergeychernyshev
33
2.2k
Statistics for Hackers
jakevdp
799
230k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.7k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
330
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.4k
What the history of the web can teach us about the future of AI
inesmontani
PRO
2
740
Transcript
土掘るHaptics potatotips #93 @cffYoHa
自己紹介 2
3 株式会社スマートバンク Android エンジニア YoHa(ようは) @cffYoHa
Haptics(触覚フィードバック)とは 4
5 Hapticsの例 https://source.android.com/docs/core/interaction/haptics/haptics-ux-foundation?hl=ja#rich-haptics https://www.youtube.com/live/l3yDd3CmA_Y?si=l69zbw11WHS9KnTN&t=277 例① - 文字選択で、指をスライドさせた際に文字 数分の振動が伝わる 例② -
Material3Expressiveにおいて 通知スタックを消す際などに リッチな振動体験が提供
Hapticsの分類 大音量で不快な可聴ノイズ 低品質な印象(安くて壊れた電話 など)を与える 非連続の状態変化 (電源オン / オフなど)の 感覚をサポート
単一の振動刺激に依存しない 豊かなハプティクス https://source.android.com/docs/core/interaction/haptics/haptics-ux-foundation 6
7 https://github.com/android/platform-samples/tree/main/samples/user-interface/haptics 公式サンプル
8 8
実装一例 AI埋蔵金チェッカー ワンバンが支出を分析し、 その中から節約ポテンシャルとなる「埋蔵金」を発見する機能 RiveファイルからEventを受け取ったタイミング(スコップで地面を掘る 時)にHapticsFBが発生 9
https://speakerdeck.com/yokomii/rivetegong-shi-quan-wointarakusiyonsuru yokomii さんの発表資料 10
Android16におけるHapticsAPIの変化 11
- BasicEnvelopeBuilder - WaveformEnvelopeBuilder 振動の振幅(Envelope)を制御することで、ス ムーズな増減が可能 新たなRich Hapticsが追加 https://developer.android.com/develop/ui/views/haptics/custom-haptic-effects#rocket-launch 12
触るぞ 💪 13
Envelope effectsが使えるかの確認方法 14 - Android 16以上 - デバイスがEnvelope effectsに対応していること -
areEnvelopeEffectsSupported()で確認可能
手持ちに最新Android16端末なかったので購入 15
対応してませんでした😭 16
既存のHapticsAPIで実装します😇 17
• DEFAULT_AMPLITUDE ◦ デバイスに設定されている標準の振動レベル ◦ ハードウェアの性能によって、0〜255 の中で指定される • createOneShot()のようなシンプルな バイブレーションのオン
/ オフは 利用すべきではないらしい 現在の実装 val vibrator = context.getSystemService(Vibrator::class.java) val vibrationEffect = VibrationEffect.createOneShot( 200, VibrationEffect.DEFAULT_AMPLITUDE, ) vibrator.vibrate(vibrationEffect) https://developer.android.com/develop/ui/views/haptics/haptics-principles 18
土を掘るということ 1. スコップで地面を刺す 2. 土の中をスコップが進む 3. スコップを上方向に持ち上げ、 地中からでる 19
ハードウェアごとに再現できる モーター性能が異なる 最大値(255)に近い値で不快なノイズが 発生することも そもそもこんなコード書くな 再現してみた① val timings = longArrayOf(
0, // 初期待機 35, // 刺さる 15, // 休止 15, // 掘る1 10, // 休止 17, // 掘る2 8, // 休止 20, // 掘る3 12, // 休止 30, // 持ち上げる 30, // 休止 ) val amplitudes = intArrayOf( 0, // 初期待機 220, // 刺さる 0, // 休止 100, // 掘る1 0, // 休止 140, // 掘る2 0, // 休止 180, // 掘る3 0, // 休止 255, // 持ち上げる 0, // サイクル間休止 ) vibrator.vibrate(VibrationEffect.createWaveform(timings, amplitudes, -1)) 20
- HapticFeedbackConstants - ハードウェアの操作(ボタン押下やキーボード入力)によく使われているため、 ユニークなFB体験にならなそう - 一方で、事前定義済みのアクションに該当する場合は、 一貫したユーザー操作体験を提供可能 -
VibrationEffect - 単発の振動から複雑な波形まで様々 - VibrationEffect.Composition(Android 11以降)を使うことで振動を合成可能 - Android16から追加のEnvelop effectsもVibrationEffectの一部 Hapticの定数を利用する 21
- Riveファイルの変更に応じて振動タイミン グを細かく修正する必要性 再現してみた②-1 val effect =
VibrationEffect.startComposition() // スコップを刺す .addPrimitive(VibrationEffect.Composition.PRIMITIVE_QUICK_FALL, 0.5f) // スコップが地中を進む(100ms 後) .addPrimitive(VibrationEffect.Composition.PRIMITIVE_TICK, 0.5f, 100) // スコップを持ち上げる(150ms 後) .addPrimitive(VibrationEffect.Composition.PRIMITIVE_QUICK_RISE, 1.0f, 150) .compose() vibrator.vibrate(effect) 22
よくわからんし、ずっと振動してるだけだな... 23
- シンプルが一番よかった - PRIMITIVE_QUICK_RISE - 重力に逆らって素早く上向きに動く様子を シュミレートする触覚効果 再現してみた②-2 val effect
= VibrationEffect.startComposition() .addPrimitive(VibrationEffect.Composition.PRIMITIVE_QUICK_RISE, 1.0f, 0) .compose() vibrator.vibrate(effect) https://developer.android.com/reference/android/os/VibrationEffect.Composition 24
まとめ 25
まとめ - Hapticsの定数を使う - 簡単に多様なデバイスで動作するHaptics体験を提供できる - ボタンやキーボード操作などはHapticFeedbackConstants - それらで表現できないものはVibrationEffect -
Hapticsは、デバイスの進化とともに豊かになった - OSVerとそのデバイスが物理的に表現可能なHapticsか、areXxxSuported() APIで確認する - 使いすぎると、ユーザーがHapticsをオフにする可能性もある - Envelope周りのHapticsAPIを触りたいならGalaxy Z Fold 7は買うな 26
Good Haptics! 27