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
社内規程RAGの精度を73.3% → 100%に改善した話
oharu121
12
7.2k
Beyond the Basics: Signal Forms
manfredsteyer
PRO
0
110
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.2k
DSPy入門 Pythonで実現する自動プロンプト最適化 〜人手によるプロンプト調整からの卒業〜
seaturt1e
1
440
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
570
grapheme_strrev関数が採択されました(あと雑感)
youkidearitai
PRO
1
200
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
340
AIプロダクト時代のQAエンジニアに求められること
imtnd
1
520
Rails Girls Tokyo 18th GMO Pepabo Sponsor Talk
yutokyokutyo
0
190
CopilotKit + AG-UIを学ぶ
nearme_tech
PRO
1
120
nilとは何か 〜interfaceの構造とnil!=nilから理解する〜
kuro_kurorrr
3
1.6k
atmaCup #23でAIコーディングを活用した話
ml_bear
4
720
Featured
See All Featured
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
65
Fireside Chat
paigeccino
41
3.8k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
220
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
150
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
110
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
220
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
430
Into the Great Unknown - MozCon
thekraken
40
2.3k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
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