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
cffYoHa
October 21, 2025
Programming
150
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
410
Other Decks in Programming
See All in Programming
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
850
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.1k
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
0
230
Java 27新機能 / Java 27 new features
kishida
2
110
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
140
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
150
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
150
Can LLMs Replicate 4 Years of Compose Migration? Exploring the boundaries of automation with 279 XML files from a real product
makun
0
130
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
480
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
740
高専キャリア LT 発表内容
crysta1221
6
5.7k
個人開発基盤をまるごとCloudflareに引っ越して爆速で総合的体験を向上させた話
tinykitten
0
180
Featured
See All Featured
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
500
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
530
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
280
Code Review Best Practice
trishagee
74
20k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
520
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
270
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
660
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
790
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
680
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