p5-phone 1.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +509 -0
- package/dist/p5-phone.js +1062 -0
- package/dist/p5-phone.min.js +10 -0
- package/examples/Phone Sensor Examples/microphone/01_mic_level/index.html +19 -0
- package/examples/Phone Sensor Examples/microphone/01_mic_level/sketch.js +117 -0
- package/examples/Phone Sensor Examples/movement/01_orientation_basic/index.html +28 -0
- package/examples/Phone Sensor Examples/movement/01_orientation_basic/sketch.js +123 -0
- package/examples/Phone Sensor Examples/movement/02_rotational_velocity/index.html +28 -0
- package/examples/Phone Sensor Examples/movement/02_rotational_velocity/sketch.js +144 -0
- package/examples/Phone Sensor Examples/movement/03_acceleration/index.html +28 -0
- package/examples/Phone Sensor Examples/movement/03_acceleration/sketch.js +87 -0
- package/examples/Phone Sensor Examples/sound/01_dual_audio/index.html +31 -0
- package/examples/Phone Sensor Examples/sound/01_dual_audio/sketch.js +225 -0
- package/examples/Phone Sensor Examples/sound/01_dual_audio/tracks/audio1.mp3 +0 -0
- package/examples/Phone Sensor Examples/sound/01_dual_audio/tracks/audio2.mp3 +0 -0
- package/examples/Phone Sensor Examples/sound/02_volume_touches/index.html +31 -0
- package/examples/Phone Sensor Examples/sound/02_volume_touches/sketch.js +269 -0
- package/examples/Phone Sensor Examples/sound/02_volume_touches/tracks/audio1.mp3 +0 -0
- package/examples/Phone Sensor Examples/touch/01_touch_basic/index.html +28 -0
- package/examples/Phone Sensor Examples/touch/01_touch_basic/sketch.js +94 -0
- package/examples/Phone Sensor Examples/touch/02_touch_zones/index.html +28 -0
- package/examples/Phone Sensor Examples/touch/02_touch_zones/sketch.js +220 -0
- package/examples/Phone Sensor Examples/touch/03_touch_count/index.html +28 -0
- package/examples/Phone Sensor Examples/touch/03_touch_count/sketch.js +93 -0
- package/examples/Phone Sensor Examples/touch/04_touch_distance/index.html +28 -0
- package/examples/Phone Sensor Examples/touch/04_touch_distance/sketch.js +120 -0
- package/examples/Phone Sensor Examples/touch/05_touch_angle/index.html +28 -0
- package/examples/Phone Sensor Examples/touch/05_touch_angle/sketch.js +117 -0
- package/examples/Phone Sensor Examples - Minimal/microphone/01_mic_level/index.html +19 -0
- package/examples/Phone Sensor Examples - Minimal/microphone/01_mic_level/sketch.js +72 -0
- package/examples/Phone Sensor Examples - Minimal/movement/01_orientation_basic/index.html +18 -0
- package/examples/Phone Sensor Examples - Minimal/movement/01_orientation_basic/sketch.js +51 -0
- package/examples/Phone Sensor Examples - Minimal/movement/02_rotational_velocity/index.html +18 -0
- package/examples/Phone Sensor Examples - Minimal/movement/02_rotational_velocity/sketch.js +70 -0
- package/examples/Phone Sensor Examples - Minimal/movement/03_acceleration/index.html +18 -0
- package/examples/Phone Sensor Examples - Minimal/movement/03_acceleration/sketch.js +83 -0
- package/examples/Phone Sensor Examples - Minimal/sound/01_sound_basic/index.html +19 -0
- package/examples/Phone Sensor Examples - Minimal/sound/01_sound_basic/sketch.js +96 -0
- package/examples/Phone Sensor Examples - Minimal/sound/01_sound_basic/tracks/audio1.mp3 +0 -0
- package/examples/Phone Sensor Examples - Minimal/sound/02_sound_amplitude/index.html +19 -0
- package/examples/Phone Sensor Examples - Minimal/sound/02_sound_amplitude/sketch.js +118 -0
- package/examples/Phone Sensor Examples - Minimal/sound/02_sound_amplitude/tracks/audio1.mp3 +0 -0
- package/examples/Phone Sensor Examples - Minimal/touch/01_touch_basic/index.html +18 -0
- package/examples/Phone Sensor Examples - Minimal/touch/01_touch_basic/sketch.js +58 -0
- package/examples/Phone Sensor Examples - Minimal/touch/02_touch_zones/index.html +18 -0
- package/examples/Phone Sensor Examples - Minimal/touch/02_touch_zones/sketch.js +78 -0
- package/examples/Phone Sensor Examples - Minimal/touch/03_touch_count/index.html +18 -0
- package/examples/Phone Sensor Examples - Minimal/touch/03_touch_count/sketch.js +64 -0
- package/examples/Phone Sensor Examples - Minimal/touch/04_touch_distance/index.html +18 -0
- package/examples/Phone Sensor Examples - Minimal/touch/04_touch_distance/sketch.js +69 -0
- package/examples/Phone Sensor Examples - Minimal/touch/05_touch_angle/index.html +18 -0
- package/examples/Phone Sensor Examples - Minimal/touch/05_touch_angle/sketch.js +85 -0
- package/examples/Phone and Gif/collision/README.md +31 -0
- Gif/collision/gifs/spaceSuit2.png +0 -0
- package/examples/Phone and Gif/collision/index.html +19 -0
- package/examples/Phone and Gif/collision/sketch.js +226 -0
- Gif/fetch/gifs/corgiswimflip.gif +0 -0
- package/examples/Phone and Gif/fetch/index.html +18 -0
- package/examples/Phone and Gif/fetch/sketch.js +139 -0
- Gif/fly/gifs/comparison.gif +0 -0
- package/examples/Phone and Gif/fly/index.html +18 -0
- package/examples/Phone and Gif/fly/sketch.js +103 -0
- Gif/roll/gifs/how-penciles-are-made.gif +0 -0
- package/examples/Phone and Gif/roll/index.html +18 -0
- package/examples/Phone and Gif/roll/sketch.js +121 -0
- package/examples/UXcompare/button-vs-movement/index.html +45 -0
- package/examples/UXcompare/button-vs-movement/sketch.js +355 -0
- package/examples/UXcompare/button-vs-orientation/index.html +25 -0
- package/examples/UXcompare/button-vs-orientation/sketch.js +317 -0
- package/examples/UXcompare/button-vs-shake/index.html +45 -0
- package/examples/UXcompare/button-vs-shake/sketch.js +320 -0
- package/examples/UXcompare/gyroscope-demo/index.html +78 -0
- package/examples/UXcompare/gyroscope-demo/sketch.js +166 -0
- package/examples/UXcompare/index.html +419 -0
- package/examples/UXcompare/microphone-demo/index.html +79 -0
- package/examples/UXcompare/microphone-demo/sketch.js +210 -0
- package/examples/UXcompare/slider-vs-angle/index.html +25 -0
- package/examples/UXcompare/slider-vs-angle/sketch.js +429 -0
- package/examples/UXcompare/slider-vs-distance/index.html +25 -0
- package/examples/UXcompare/slider-vs-distance/sketch.js +401 -0
- package/examples/UXcompare/slider-vs-microphone/index.html +26 -0
- package/examples/UXcompare/slider-vs-microphone/sketch.js +336 -0
- package/examples/UXcompare/slider-vs-touches/index.html +25 -0
- package/examples/UXcompare/slider-vs-touches/sketch.js +376 -0
- package/examples/UXcompare/sliders-vs-acceleration/index.html +25 -0
- package/examples/UXcompare/sliders-vs-acceleration/sketch.js +361 -0
- package/examples/UXcompare/sliders-vs-rotation/index.html +25 -0
- package/examples/UXcompare/sliders-vs-rotation/sketch.js +375 -0
- package/examples/blankTemplate/index.html +31 -0
- package/examples/blankTemplate/sketch.js +55 -0
- package/examples/homepage/index.html +506 -0
- package/package.json +73 -0
- package/src/p5-phone.js +1062 -0
- package/src/permissionMic.js +240 -0
- package/src/permissionsGesture.js +213 -0
- package/src/permissionsGyro.js +246 -0
|
@@ -0,0 +1,506 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>P5.js Mobile Interaction Examples</title>
|
|
7
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
|
|
8
|
+
<style>
|
|
9
|
+
* {
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
body {
|
|
16
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
17
|
+
background: #ffffff;
|
|
18
|
+
color: #000000;
|
|
19
|
+
line-height: 1.6;
|
|
20
|
+
padding: 40px 20px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.container {
|
|
24
|
+
max-width: 1200px;
|
|
25
|
+
margin: 0 auto;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
h1 {
|
|
29
|
+
font-size: 2.5rem;
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
margin-bottom: 1rem;
|
|
32
|
+
letter-spacing: -0.02em;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.subtitle {
|
|
36
|
+
font-size: 1.2rem;
|
|
37
|
+
color: #666;
|
|
38
|
+
margin-bottom: 3rem;
|
|
39
|
+
font-weight: 400;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.section {
|
|
43
|
+
margin-bottom: 4rem;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.section-title {
|
|
47
|
+
font-size: 1.8rem;
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
margin-bottom: 1.5rem;
|
|
50
|
+
padding-bottom: 0.5rem;
|
|
51
|
+
border-bottom: 2px solid #000;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.examples-grid {
|
|
55
|
+
display: grid;
|
|
56
|
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
|
57
|
+
gap: 2rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.example-card {
|
|
61
|
+
border: 2px solid #000;
|
|
62
|
+
padding: 1.5rem;
|
|
63
|
+
transition: transform 0.2s, box-shadow 0.2s;
|
|
64
|
+
background: #fff;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.example-card:hover {
|
|
68
|
+
transform: translateY(-4px);
|
|
69
|
+
box-shadow: 8px 8px 0 #000;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.example-title {
|
|
73
|
+
font-size: 1.2rem;
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
margin-bottom: 0.5rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.example-description {
|
|
79
|
+
color: #666;
|
|
80
|
+
font-size: 0.9rem;
|
|
81
|
+
margin-bottom: 1rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.example-link {
|
|
85
|
+
display: inline-block;
|
|
86
|
+
color: #000;
|
|
87
|
+
text-decoration: none;
|
|
88
|
+
font-weight: 600;
|
|
89
|
+
padding: 0.5rem 1rem;
|
|
90
|
+
border: 2px solid #000;
|
|
91
|
+
transition: background 0.2s, color 0.2s;
|
|
92
|
+
margin-bottom: 1rem;
|
|
93
|
+
margin-right: 0.5rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.example-link:hover {
|
|
97
|
+
background: #000;
|
|
98
|
+
color: #fff;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.github-link {
|
|
102
|
+
display: inline-block;
|
|
103
|
+
color: #666;
|
|
104
|
+
text-decoration: none;
|
|
105
|
+
font-size: 0.9rem;
|
|
106
|
+
padding: 0.5rem 1rem;
|
|
107
|
+
border: 1px solid #666;
|
|
108
|
+
transition: background 0.2s, color 0.2s;
|
|
109
|
+
margin-bottom: 1rem;
|
|
110
|
+
margin-right: 0.5rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.github-link:hover {
|
|
114
|
+
background: #666;
|
|
115
|
+
color: #fff;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.links-group {
|
|
119
|
+
margin-bottom: 1rem;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.link-label {
|
|
123
|
+
font-size: 0.75rem;
|
|
124
|
+
color: #999;
|
|
125
|
+
text-transform: uppercase;
|
|
126
|
+
letter-spacing: 0.5px;
|
|
127
|
+
margin-top: 0.5rem;
|
|
128
|
+
margin-bottom: 0.25rem;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.qr-code {
|
|
132
|
+
margin-top: 1rem;
|
|
133
|
+
text-align: center;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.qr-code canvas {
|
|
137
|
+
border: 2px solid #000;
|
|
138
|
+
padding: 10px;
|
|
139
|
+
background: white;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
footer {
|
|
143
|
+
margin-top: 4rem;
|
|
144
|
+
padding-top: 2rem;
|
|
145
|
+
border-top: 2px solid #000;
|
|
146
|
+
text-align: center;
|
|
147
|
+
color: #666;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
footer a {
|
|
151
|
+
color: #000;
|
|
152
|
+
text-decoration: none;
|
|
153
|
+
font-weight: 600;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
footer a:hover {
|
|
157
|
+
text-decoration: underline;
|
|
158
|
+
}
|
|
159
|
+
</style>
|
|
160
|
+
</head>
|
|
161
|
+
<body>
|
|
162
|
+
<div class="container">
|
|
163
|
+
<h1>P5.js Mobile Interaction Examples</h1>
|
|
164
|
+
<p class="subtitle">Interactive examples demonstrating mobile device capabilities with p5.js</p>
|
|
165
|
+
|
|
166
|
+
<!-- Blank Template -->
|
|
167
|
+
<div class="section">
|
|
168
|
+
<h2 class="section-title">Getting Started</h2>
|
|
169
|
+
<div class="examples-grid">
|
|
170
|
+
<div class="example-card">
|
|
171
|
+
<div class="example-title">Blank Template</div>
|
|
172
|
+
<p class="example-description">Basic setup from the README - a starting point for your own projects</p>
|
|
173
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/R-c_HpeUg" target="_blank" class="example-link">Web Editor →</a>
|
|
174
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/blankTemplate" target="_blank" class="github-link">View Code</a>
|
|
175
|
+
</div>
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<!-- Touch Examples -->
|
|
180
|
+
<div class="section">
|
|
181
|
+
<h2 class="section-title">Touch Interactions</h2>
|
|
182
|
+
<div class="examples-grid">
|
|
183
|
+
<div class="example-card">
|
|
184
|
+
<div class="example-title">01. Basic Touch</div>
|
|
185
|
+
<p class="example-description">Detect touch events and track duration</p>
|
|
186
|
+
<a href="Phone Sensor Examples/touch/01_touch_basic/" class="example-link">Launch Example →</a>
|
|
187
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/zIRMsYKRN" target="_blank" class="example-link">Web Editor →</a>
|
|
188
|
+
<div class="links-group">
|
|
189
|
+
<div class="link-label">View on GitHub:</div>
|
|
190
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/touch/01_touch_basic" target="_blank" class="github-link">Full Version</a>
|
|
191
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/touch/01_touch_basic" target="_blank" class="github-link">Minimal</a>
|
|
192
|
+
</div>
|
|
193
|
+
<div class="qr-code" id="qr-touch-01"></div>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div class="example-card">
|
|
197
|
+
<div class="example-title">02. Touch Zones</div>
|
|
198
|
+
<p class="example-description">Screen divided into 4 interactive zones</p>
|
|
199
|
+
<a href="Phone Sensor Examples/touch/02_touch_zones/" class="example-link">Launch Example →</a>
|
|
200
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/PkhKKZWMC" target="_blank" class="example-link">Web Editor →</a>
|
|
201
|
+
<div class="links-group">
|
|
202
|
+
<div class="link-label">View on GitHub:</div>
|
|
203
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/touch/02_touch_zones" target="_blank" class="github-link">Full Version</a>
|
|
204
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/touch/02_touch_zones" target="_blank" class="github-link">Minimal</a>
|
|
205
|
+
</div>
|
|
206
|
+
<div class="qr-code" id="qr-touch-02"></div>
|
|
207
|
+
</div>
|
|
208
|
+
|
|
209
|
+
<div class="example-card">
|
|
210
|
+
<div class="example-title">03. Touch Count</div>
|
|
211
|
+
<p class="example-description">Count simultaneous touch points</p>
|
|
212
|
+
<a href="Phone Sensor Examples/touch/03_touch_count/" class="example-link">Launch Example →</a>
|
|
213
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/g-9HeBb8B" target="_blank" class="example-link">Web Editor →</a>
|
|
214
|
+
<div class="links-group">
|
|
215
|
+
<div class="link-label">View on GitHub:</div>
|
|
216
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/touch/03_touch_count" target="_blank" class="github-link">Full Version</a>
|
|
217
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/touch/03_touch_count" target="_blank" class="github-link">Minimal</a>
|
|
218
|
+
</div>
|
|
219
|
+
<div class="qr-code" id="qr-touch-03"></div>
|
|
220
|
+
</div>
|
|
221
|
+
|
|
222
|
+
<div class="example-card">
|
|
223
|
+
<div class="example-title">04. Touch Distance</div>
|
|
224
|
+
<p class="example-description">Measure distance between two touches</p>
|
|
225
|
+
<a href="Phone Sensor Examples/touch/04_touch_distance/" class="example-link">Launch Example →</a>
|
|
226
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/s6icb8y_o" target="_blank" class="example-link">Web Editor →</a>
|
|
227
|
+
<div class="links-group">
|
|
228
|
+
<div class="link-label">View on GitHub:</div>
|
|
229
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/touch/04_touch_distance" target="_blank" class="github-link">Full Version</a>
|
|
230
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/touch/04_touch_distance" target="_blank" class="github-link">Minimal</a>
|
|
231
|
+
</div>
|
|
232
|
+
<div class="qr-code" id="qr-touch-04"></div>
|
|
233
|
+
</div>
|
|
234
|
+
|
|
235
|
+
<div class="example-card">
|
|
236
|
+
<div class="example-title">05. Touch Angle</div>
|
|
237
|
+
<p class="example-description">Calculate angle between two touch points</p>
|
|
238
|
+
<a href="Phone Sensor Examples/touch/05_touch_angle/" class="example-link">Launch Example →</a>
|
|
239
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/IPYIo8_FV" target="_blank" class="example-link">Web Editor →</a>
|
|
240
|
+
<div class="links-group">
|
|
241
|
+
<div class="link-label">View on GitHub:</div>
|
|
242
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/touch/05_touch_angle" target="_blank" class="github-link">Full Version</a>
|
|
243
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/touch/05_touch_angle" target="_blank" class="github-link">Minimal</a>
|
|
244
|
+
</div>
|
|
245
|
+
<div class="qr-code" id="qr-touch-05"></div>
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
|
|
250
|
+
<!-- Movement Examples -->
|
|
251
|
+
<div class="section">
|
|
252
|
+
<h2 class="section-title">Device Motion</h2>
|
|
253
|
+
<div class="examples-grid">
|
|
254
|
+
<div class="example-card">
|
|
255
|
+
<div class="example-title">01. Orientation</div>
|
|
256
|
+
<p class="example-description">Basic device orientation detection</p>
|
|
257
|
+
<a href="Phone Sensor Examples/movement/01_orientation_basic/" class="example-link">Launch Example →</a>
|
|
258
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/Sf_um9wYw" target="_blank" class="example-link">Web Editor →</a>
|
|
259
|
+
<div class="links-group">
|
|
260
|
+
<div class="link-label">View on GitHub:</div>
|
|
261
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/movement/01_orientation_basic" target="_blank" class="github-link">Full Version</a>
|
|
262
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/movement/01_orientation_basic" target="_blank" class="github-link">Minimal</a>
|
|
263
|
+
</div>
|
|
264
|
+
<div class="qr-code" id="qr-movement-01"></div>
|
|
265
|
+
</div>
|
|
266
|
+
|
|
267
|
+
<div class="example-card">
|
|
268
|
+
<div class="example-title">02. Rotational Velocity</div>
|
|
269
|
+
<p class="example-description">Calculate rotation speed using sensors</p>
|
|
270
|
+
<a href="Phone Sensor Examples/movement/02_rotational_velocity/" class="example-link">Launch Example →</a>
|
|
271
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/IDSid9rOX" target="_blank" class="example-link">Web Editor →</a>
|
|
272
|
+
<div class="links-group">
|
|
273
|
+
<div class="link-label">View on GitHub:</div>
|
|
274
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/movement/02_rotational_velocity" target="_blank" class="github-link">Full Version</a>
|
|
275
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/movement/02_rotational_velocity" target="_blank" class="github-link">Minimal</a>
|
|
276
|
+
</div>
|
|
277
|
+
<div class="qr-code" id="qr-movement-02"></div>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
<div class="example-card">
|
|
281
|
+
<div class="example-title">03. Acceleration</div>
|
|
282
|
+
<p class="example-description">Display device acceleration data</p>
|
|
283
|
+
<a href="Phone Sensor Examples/movement/03_acceleration/" class="example-link">Launch Example →</a>
|
|
284
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/xaxOYgK9q" target="_blank" class="example-link">Web Editor →</a>
|
|
285
|
+
<div class="links-group">
|
|
286
|
+
<div class="link-label">View on GitHub:</div>
|
|
287
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/movement/03_acceleration" target="_blank" class="github-link">Full Version</a>
|
|
288
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/movement/03_acceleration" target="_blank" class="github-link">Minimal</a>
|
|
289
|
+
</div>
|
|
290
|
+
<div class="qr-code" id="qr-movement-03"></div>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
</div>
|
|
294
|
+
|
|
295
|
+
<!-- Microphone Examples -->
|
|
296
|
+
<div class="section">
|
|
297
|
+
<h2 class="section-title">Audio Input</h2>
|
|
298
|
+
<div class="examples-grid">
|
|
299
|
+
<div class="example-card">
|
|
300
|
+
<div class="example-title">01. Microphone Level</div>
|
|
301
|
+
<p class="example-description">Visualize audio input with threshold</p>
|
|
302
|
+
<a href="Phone Sensor Examples/microphone/01_mic_level/" class="example-link">Launch Example →</a>
|
|
303
|
+
<a href="https://editor.p5js.org/creationcomputation/sketches/ySuEk7s6-" target="_blank" class="example-link">Web Editor →</a>
|
|
304
|
+
<div class="links-group">
|
|
305
|
+
<div class="link-label">View on GitHub:</div>
|
|
306
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/microphone/01_mic_level" target="_blank" class="github-link">Full Version</a>
|
|
307
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/microphone/01_mic_level" target="_blank" class="github-link">Minimal</a>
|
|
308
|
+
</div>
|
|
309
|
+
<div class="qr-code" id="qr-mic-01"></div>
|
|
310
|
+
</div>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
<!-- Sound Playback Examples -->
|
|
315
|
+
<div class="section">
|
|
316
|
+
<h2 class="section-title">Audio Playback</h2>
|
|
317
|
+
<div class="examples-grid">
|
|
318
|
+
<div class="example-card">
|
|
319
|
+
<div class="example-title">01. Sound Basic</div>
|
|
320
|
+
<p class="example-description">Play/pause audio with touch control</p>
|
|
321
|
+
<a href="Phone Sensor Examples/sound/01_dual_audio/" class="example-link">Launch Example →</a>
|
|
322
|
+
<div class="links-group">
|
|
323
|
+
<div class="link-label">View on GitHub:</div>
|
|
324
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/sound/01_dual_audio" target="_blank" class="github-link">Full Version</a>
|
|
325
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/sound/01_sound_basic" target="_blank" class="github-link">Minimal</a>
|
|
326
|
+
</div>
|
|
327
|
+
<div class="qr-code" id="qr-sound-01"></div>
|
|
328
|
+
</div>
|
|
329
|
+
|
|
330
|
+
<div class="example-card">
|
|
331
|
+
<div class="example-title">02. Volume by Touches</div>
|
|
332
|
+
<p class="example-description">Control audio volume with multiple touches</p>
|
|
333
|
+
<a href="Phone Sensor Examples/sound/02_volume_touches/" class="example-link">Launch Example →</a>
|
|
334
|
+
<div class="links-group">
|
|
335
|
+
<div class="link-label">View on GitHub:</div>
|
|
336
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples/sound/02_volume_touches" target="_blank" class="github-link">Full Version</a>
|
|
337
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20Sensor%20Examples%20-%20Minimal/sound/02_sound_amplitude" target="_blank" class="github-link">Minimal</a>
|
|
338
|
+
</div>
|
|
339
|
+
<div class="qr-code" id="qr-sound-02"></div>
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
</div>
|
|
343
|
+
|
|
344
|
+
<!-- Phone and GIF Examples -->
|
|
345
|
+
<div class="section">
|
|
346
|
+
<h2 class="section-title">Interactive GIF Examples</h2>
|
|
347
|
+
<div class="examples-grid">
|
|
348
|
+
<div class="example-card">
|
|
349
|
+
<div class="example-title">Fetch</div>
|
|
350
|
+
<p class="example-description">Touch-controlled corgi fetching animation</p>
|
|
351
|
+
<a href="Phone and Gif/fetch/" class="example-link">Launch Example →</a>
|
|
352
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20and%20Gif/fetch" target="_blank" class="github-link">View Code</a>
|
|
353
|
+
<div class="qr-code" id="qr-gif-fetch"></div>
|
|
354
|
+
</div>
|
|
355
|
+
|
|
356
|
+
<div class="example-card">
|
|
357
|
+
<div class="example-title">Roll</div>
|
|
358
|
+
<p class="example-description">Tilt-controlled pencil rolling animation</p>
|
|
359
|
+
<a href="Phone and Gif/roll/" class="example-link">Launch Example →</a>
|
|
360
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20and%20Gif/roll" target="_blank" class="github-link">View Code</a>
|
|
361
|
+
<div class="qr-code" id="qr-gif-roll"></div>
|
|
362
|
+
</div>
|
|
363
|
+
|
|
364
|
+
<div class="example-card">
|
|
365
|
+
<div class="example-title">Fly</div>
|
|
366
|
+
<p class="example-description">Acceleration-controlled airplane window</p>
|
|
367
|
+
<a href="Phone and Gif/fly/" class="example-link">Launch Example →</a>
|
|
368
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/Phone%20and%20Gif/fly" target="_blank" class="github-link">View Code</a>
|
|
369
|
+
<div class="qr-code" id="qr-gif-fly"></div>
|
|
370
|
+
</div>
|
|
371
|
+
</div>
|
|
372
|
+
</div>
|
|
373
|
+
|
|
374
|
+
<!-- UX Comparison Examples -->
|
|
375
|
+
<div class="section">
|
|
376
|
+
<h2 class="section-title">UX Comparison Examples</h2>
|
|
377
|
+
<div class="examples-grid">
|
|
378
|
+
<div class="example-card">
|
|
379
|
+
<div class="example-title">Button vs Shake Detection</div>
|
|
380
|
+
<p class="example-description">Compare clicking a button vs shaking your device to trigger actions</p>
|
|
381
|
+
<a href="UXcompare/button-vs-shake/" class="example-link">Launch Example →</a>
|
|
382
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/UXcompare/button-vs-shake" target="_blank" class="github-link">View Code</a>
|
|
383
|
+
<div class="qr-code" id="qr-ux-button-shake"></div>
|
|
384
|
+
</div>
|
|
385
|
+
|
|
386
|
+
<div class="example-card">
|
|
387
|
+
<div class="example-title">Button vs Movement Detection</div>
|
|
388
|
+
<p class="example-description">Compare button clicks vs device movement for interaction control</p>
|
|
389
|
+
<a href="UXcompare/button-vs-movement/" class="example-link">Launch Example →</a>
|
|
390
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/UXcompare/button-vs-movement" target="_blank" class="github-link">View Code</a>
|
|
391
|
+
<div class="qr-code" id="qr-ux-button-movement"></div>
|
|
392
|
+
</div>
|
|
393
|
+
|
|
394
|
+
<div class="example-card">
|
|
395
|
+
<div class="example-title">Button vs Orientation</div>
|
|
396
|
+
<p class="example-description">Compare button interface vs device orientation for control</p>
|
|
397
|
+
<a href="UXcompare/button-vs-orientation/" class="example-link">Launch Example →</a>
|
|
398
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/UXcompare/button-vs-orientation" target="_blank" class="github-link">View Code</a>
|
|
399
|
+
<div class="qr-code" id="qr-ux-button-orientation"></div>
|
|
400
|
+
</div>
|
|
401
|
+
|
|
402
|
+
<div class="example-card">
|
|
403
|
+
<div class="example-title">Sliders vs Device Rotation</div>
|
|
404
|
+
<p class="example-description">RGB color control: traditional sliders vs device rotation</p>
|
|
405
|
+
<a href="UXcompare/sliders-vs-rotation/" class="example-link">Launch Example →</a>
|
|
406
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/UXcompare/sliders-vs-rotation" target="_blank" class="github-link">View Code</a>
|
|
407
|
+
<div class="qr-code" id="qr-ux-sliders-rotation"></div>
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
<div class="example-card">
|
|
411
|
+
<div class="example-title">Sliders vs Device Acceleration</div>
|
|
412
|
+
<p class="example-description">RGB color control: traditional sliders vs device acceleration</p>
|
|
413
|
+
<a href="UXcompare/sliders-vs-acceleration/" class="example-link">Launch Example →</a>
|
|
414
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/UXcompare/sliders-vs-acceleration" target="_blank" class="github-link">View Code</a>
|
|
415
|
+
<div class="qr-code" id="qr-ux-sliders-acceleration"></div>
|
|
416
|
+
</div>
|
|
417
|
+
|
|
418
|
+
<div class="example-card">
|
|
419
|
+
<div class="example-title">Slider vs Microphone</div>
|
|
420
|
+
<p class="example-description">Volume control: traditional slider vs microphone input level</p>
|
|
421
|
+
<a href="UXcompare/slider-vs-microphone/" class="example-link">Launch Example →</a>
|
|
422
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/UXcompare/slider-vs-microphone" target="_blank" class="github-link">View Code</a>
|
|
423
|
+
<div class="qr-code" id="qr-ux-slider-microphone"></div>
|
|
424
|
+
</div>
|
|
425
|
+
|
|
426
|
+
<div class="example-card">
|
|
427
|
+
<div class="example-title">Slider vs Multi-Touch</div>
|
|
428
|
+
<p class="example-description">Value control: single slider vs multiple finger touches</p>
|
|
429
|
+
<a href="UXcompare/slider-vs-touches/" class="example-link">Launch Example →</a>
|
|
430
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/UXcompare/slider-vs-touches" target="_blank" class="github-link">View Code</a>
|
|
431
|
+
<div class="qr-code" id="qr-ux-slider-touches"></div>
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
<div class="example-card">
|
|
435
|
+
<div class="example-title">Slider vs Distance</div>
|
|
436
|
+
<p class="example-description">Value control: traditional slider vs finger distance measurement</p>
|
|
437
|
+
<a href="UXcompare/slider-vs-distance/" class="example-link">Launch Example →</a>
|
|
438
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/UXcompare/slider-vs-distance" target="_blank" class="github-link">View Code</a>
|
|
439
|
+
<div class="qr-code" id="qr-ux-slider-distance"></div>
|
|
440
|
+
</div>
|
|
441
|
+
|
|
442
|
+
<div class="example-card">
|
|
443
|
+
<div class="example-title">Slider vs Angle Control</div>
|
|
444
|
+
<p class="example-description">Value control: linear slider vs multi-touch angle detection</p>
|
|
445
|
+
<a href="UXcompare/slider-vs-angle/" class="example-link">Launch Example →</a>
|
|
446
|
+
<a href="https://github.com/DigitalFuturesOCADU/P5-Phone-Interactions/tree/main/examples/UXcompare/slider-vs-angle" target="_blank" class="github-link">View Code</a>
|
|
447
|
+
<div class="qr-code" id="qr-ux-slider-angle"></div>
|
|
448
|
+
</div>
|
|
449
|
+
</div>
|
|
450
|
+
</div>
|
|
451
|
+
|
|
452
|
+
<footer>
|
|
453
|
+
<p>Built with <a href="https://p5js.org/" target="_blank">p5.js</a> and <a href="https://github.com/DigitalFuturesOCADU/mobile-p5-permissions" target="_blank">mobile-p5-permissions</a></p>
|
|
454
|
+
<p>2025 Digital Futures OCADU</p>
|
|
455
|
+
</footer>
|
|
456
|
+
</div>
|
|
457
|
+
|
|
458
|
+
<script>
|
|
459
|
+
// Wait for QRCode library to load
|
|
460
|
+
window.addEventListener('load', function() {
|
|
461
|
+
// Generate QR codes for all examples
|
|
462
|
+
const baseURL = 'https://digitalfuturesocadu.github.io/P5-Phone-Interactions/examples/';
|
|
463
|
+
|
|
464
|
+
const examples = [
|
|
465
|
+
{ id: 'qr-touch-01', url: 'Phone%20Sensor%20Examples/touch/01_touch_basic/' },
|
|
466
|
+
{ id: 'qr-touch-02', url: 'Phone%20Sensor%20Examples/touch/02_touch_zones/' },
|
|
467
|
+
{ id: 'qr-touch-03', url: 'Phone%20Sensor%20Examples/touch/03_touch_count/' },
|
|
468
|
+
{ id: 'qr-touch-04', url: 'Phone%20Sensor%20Examples/touch/04_touch_distance/' },
|
|
469
|
+
{ id: 'qr-touch-05', url: 'Phone%20Sensor%20Examples/touch/05_touch_angle/' },
|
|
470
|
+
{ id: 'qr-movement-01', url: 'Phone%20Sensor%20Examples/movement/01_orientation_basic/' },
|
|
471
|
+
{ id: 'qr-movement-02', url: 'Phone%20Sensor%20Examples/movement/02_rotational_velocity/' },
|
|
472
|
+
{ id: 'qr-movement-03', url: 'Phone%20Sensor%20Examples/movement/03_acceleration/' },
|
|
473
|
+
{ id: 'qr-mic-01', url: 'Phone%20Sensor%20Examples/microphone/01_mic_level/' },
|
|
474
|
+
{ id: 'qr-sound-01', url: 'Phone%20Sensor%20Examples/sound/01_dual_audio/' },
|
|
475
|
+
{ id: 'qr-sound-02', url: 'Phone%20Sensor%20Examples/sound/02_volume_touches/' },
|
|
476
|
+
{ id: 'qr-gif-fetch', url: 'Phone%20and%20Gif/fetch/' },
|
|
477
|
+
{ id: 'qr-gif-roll', url: 'Phone%20and%20Gif/roll/' },
|
|
478
|
+
{ id: 'qr-gif-fly', url: 'Phone%20and%20Gif/fly/' },
|
|
479
|
+
{ id: 'qr-ux-button-shake', url: 'UXcompare/button-vs-shake/' },
|
|
480
|
+
{ id: 'qr-ux-button-movement', url: 'UXcompare/button-vs-movement/' },
|
|
481
|
+
{ id: 'qr-ux-button-orientation', url: 'UXcompare/button-vs-orientation/' },
|
|
482
|
+
{ id: 'qr-ux-sliders-rotation', url: 'UXcompare/sliders-vs-rotation/' },
|
|
483
|
+
{ id: 'qr-ux-sliders-acceleration', url: 'UXcompare/sliders-vs-acceleration/' },
|
|
484
|
+
{ id: 'qr-ux-slider-microphone', url: 'UXcompare/slider-vs-microphone/' },
|
|
485
|
+
{ id: 'qr-ux-slider-touches', url: 'UXcompare/slider-vs-touches/' },
|
|
486
|
+
{ id: 'qr-ux-slider-distance', url: 'UXcompare/slider-vs-distance/' },
|
|
487
|
+
{ id: 'qr-ux-slider-angle', url: 'UXcompare/slider-vs-angle/' }
|
|
488
|
+
];
|
|
489
|
+
|
|
490
|
+
examples.forEach(example => {
|
|
491
|
+
const fullURL = baseURL + example.url;
|
|
492
|
+
const container = document.getElementById(example.id);
|
|
493
|
+
container.innerHTML = ''; // Clear any existing content
|
|
494
|
+
new QRCode(container, {
|
|
495
|
+
text: fullURL,
|
|
496
|
+
width: 150,
|
|
497
|
+
height: 150,
|
|
498
|
+
colorDark: '#000000',
|
|
499
|
+
colorLight: '#ffffff',
|
|
500
|
+
correctLevel: QRCode.CorrectLevel.M
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
</script>
|
|
505
|
+
</body>
|
|
506
|
+
</html>
|
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "p5-phone",
|
|
3
|
+
"version": "1.4.4",
|
|
4
|
+
"description": "Simplified mobile hardware access for p5.js - handle sensors, microphone, touch, and browser gestures with ease",
|
|
5
|
+
"main": "src/p5-phone.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"src/",
|
|
8
|
+
"dist/",
|
|
9
|
+
"examples/",
|
|
10
|
+
"README.md",
|
|
11
|
+
"LICENSE"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "npx terser src/p5-phone.js --compress --mangle --output dist/p5-phone.min.js && cp src/p5-phone.js dist/p5-phone.js",
|
|
15
|
+
"test": "echo \"No tests specified\" && exit 0",
|
|
16
|
+
"prepublishOnly": "npm run build",
|
|
17
|
+
"prepare": "npm run build",
|
|
18
|
+
"version": "echo \"Version bumped to $npm_package_version\"",
|
|
19
|
+
"postversion": "git push && git push --tags",
|
|
20
|
+
"release:patch": "npm version patch",
|
|
21
|
+
"release:minor": "npm version minor",
|
|
22
|
+
"release:major": "npm version major",
|
|
23
|
+
"release:dry": "npm version --dry-run"
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/DigitalFuturesOCADU/p5-phone.git"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"p5js",
|
|
31
|
+
"mobile",
|
|
32
|
+
"permissions",
|
|
33
|
+
"touch",
|
|
34
|
+
"gyroscope",
|
|
35
|
+
"accelerometer",
|
|
36
|
+
"microphone",
|
|
37
|
+
"gesture-blocking",
|
|
38
|
+
"mobile-web",
|
|
39
|
+
"creative-coding",
|
|
40
|
+
"javascript",
|
|
41
|
+
"ios",
|
|
42
|
+
"android",
|
|
43
|
+
"deviceorientation",
|
|
44
|
+
"devicemotion",
|
|
45
|
+
"web-audio"
|
|
46
|
+
],
|
|
47
|
+
"author": "Digital Futures OCADU",
|
|
48
|
+
"license": "MIT",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/DigitalFuturesOCADU/p5-phone/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/DigitalFuturesOCADU/p5-phone#readme",
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"p5": "^1.0.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"terser": "^5.44.0"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=12.0.0"
|
|
61
|
+
},
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public",
|
|
64
|
+
"registry": "https://registry.npmjs.org/"
|
|
65
|
+
},
|
|
66
|
+
"browserslist": [
|
|
67
|
+
"iOS >= 13",
|
|
68
|
+
"Android >= 7",
|
|
69
|
+
"Chrome >= 80",
|
|
70
|
+
"Safari >= 13",
|
|
71
|
+
"Firefox >= 75"
|
|
72
|
+
]
|
|
73
|
+
}
|