
Show HN: Swip.js, a library to create multi device experiments - brackcurly
https://github.com/paulsonnentag/swip
======
rawnlq
Using the devices as planes for the golf demo is incredibly creative!

[https://www.youtube.com/watch?v=ZE0gxa-p8HY](https://www.youtube.com/watch?v=ZE0gxa-p8HY)

I know you can use HTML5 DeviceOrientation for angle and the "swip" for
relative positioning. But how did you get the physical size of the screen of
each device?

~~~
brackcurly
We haven't figured out a way to do this automatically. Currently we prompt the
user to enter the size of the device when the app is opened for the first
time.

~~~
BonoboBoner
How do you know which device is positioned higher than the other (on a bunch
of books)?

~~~
asher_
Based on the demo they showed, this isn't needed. As long as they know the
orientation of the device relative to a flat plane they can move the virtual
items within the bounds of that device's screen. When it crosses over on to
another device, it only needs to calculate movement based on it's relative
orientation.

~~~
timgrossmann
Yes, exactly. If it enters the space of a tilted device, a force (depending on
the rotation of the device) is applied to ball.

------
anotheryou
Does anyone know how well you can time via an app?

I wonder how it sounds to play sound across devices. Streaming and clock
syncing can happen beforehand, just the playback has to be very sync to an
absolute timing.

Maybe one can do something crude sound propagation synthesis by playing with
timing, sound runtime, gps and a crowd. If you synthesize the sound the app
even stays very small. You could e.g. make an ocean wave roll through the
audience (when every device knows where it is and knows the exact time of when
the wave will hit that position).

Same could work with devices as pixels, but I don't find it that interesting.

~~~
Normal_gaussian
If you are playing sound you can use the microphone for synchronisation.

~~~
anotheryou
hehe, right, but it will get messy in a crowd. Maybe fun though, if the phones
first try to agree on a timing.

------
mcs_
I don't have a use case for this (yet) but ... the demo is absolutely
incredible. Very nice work

~~~
elwell
I agree, but could go without the royalty free bg music.

------
addedlovely
Wow, great work. I assume the pinch gesture calibrates the positioning and is
always center of the screen? The bounce off the screen edge on pong is
satisfying.

~~~
brackcurly
You're right, when the server receives two swipe events at the same time in
opposite directions we assume that both devices are aligned at this point. It
doesn't matter though where on the screen you pinch them together,.

------
Lxr
That golf game has a lot of potential even as a native app, nice!

