Define a surface and add an object.
<div id="surface"> <div id="surface-object"></div> </div> <script> const surface = new FrictionDOM.Surface("surface"); const object = new FrictionDOM.SurfaceObject("surface-object", surface); </script>
Receive touch-friendly interactive motion.
View the source code of each to learn how it was done.
Motion can be applied to more than just position, height and width is changed in this demo.
An introductory demo showing a interactable object within a boundary.
This is a flex of available callbacks and events to re-create some of the iOS mail experience.
Axis can be locked to limit motion to a single direction.
You can add an extra layer of elasticity by nesting objects and surfaces.
Set nudge thresholding to disallow objects to be hover in no mans land.
This is currently considered experimental. To be honest it will likely never move out of experimental status... only playing around with an idea. It's reached a point where I could now reach for this in some personal projects when I'd like to. Should I have needs that require further developement on it perhaps then I'll get it more stable and built out. Some remaining things I'd most likely have to work on next:
SurfaceObject
needs to be supported. There is
very basic "click" passthrough now to meet basic use cases but this would need to be a bit more robust for use
cases like forms.
Surface
and SurfaceObject
.
SurfactObject
s. I added vertical support for the iOS demo because that
is a common use as I'd see it, but this should also work horizontally (less likely, but no reason some features
should only work Y axis and not X axis.
goto
. Thresholding is a bit buggy currently... would want to fix that. In the same sense
the code for goto
just "pushes" the object so it perfectly makes it to a boundary. This results in really
slow movements that can be frustrating. Maybe this should be more spring oriented or something similar.
Maybe goto
is customizable. Not sure, but it's not great behavior currently.