Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
土掘るHaptics
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
cffYoHa
October 21, 2025
Programming
0
110
土掘るHaptics
potatotips #93 iOS/Android開発Tips共有会
cffYoHa
October 21, 2025
Tweet
Share
More Decks by cffYoHa
See All by cffYoHa
Grid表示のレイアウトで Flow layoutsを使う
cffyoha
1
380
Other Decks in Programming
See All in Programming
CSC307 Lecture 01
javiergs
PRO
0
690
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
690
Best-Practices-for-Cortex-Analyst-and-AI-Agent
ryotaroikeda
1
110
CSC307 Lecture 06
javiergs
PRO
0
690
Fragmented Architectures
denyspoltorak
0
160
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
290
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
730
AI時代の認知負荷との向き合い方
optfit
0
160
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
1
970
Featured
See All Featured
Become a Pro
speakerdeck
PRO
31
5.8k
The Curse of the Amulet
leimatthew05
1
8.6k
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
220
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
67
The Mindset for Success: Future Career Progression
greggifford
PRO
0
240
Designing for Performance
lara
610
70k
Technical Leadership for Architectural Decision Making
baasie
1
240
How GitHub (no longer) Works
holman
316
140k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
140
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
Side Projects
sachag
455
43k
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