inertia

Inertia Javascript

dust's picture

does anyone know an easy way to do inertia in javascript ? i know qc has inertia built in which is fine but i'm making an iPad app that is is a remote for qc so the controls need to be the same on both. i'm using inertia in qc. i know the iphone has inertia scrolling so maybe someone knows some stock sdk code for inertia or how to do in javascript in qc.

im going to experiment.

would this work. ?

d = (p2-p1);

s = 8;

inertia = ((inertia += d) / s));

s being the speed variable. i really want to incorporate friction as well.

any help would be awesome.

i've been poking around paul bourkes site thinking he may have a function.

im going to poke around some BBCode and see if i can find a inertia function.

maybe look for a framework or something ?

it doesn't matter what language. i said java script because i can convert javascript to what ever language i want.

help please. i know someone out there has a function built.

Simple Track Ball With Inertia (Composition by dust)

Author: dust
License: MIT
Date: 2010.03.26
Compatibility: 10.5, 10.6
Categories:
Required plugins:
(none)

here is a simple trackball you can use with exposed orientation values. now like the title says this is just a simple dirty implementation of a trackball. there is a simple patch that is basically a few math expressions nothing more than some 2nd grade math as in addition multiplication and division maybe division is 3rd grade can't remember now. so the simple patch should run on leopard as its just a few equations.

there is also a snow leopard patch that acts more like the stock trackball with inertia and friction etc..... like i said again this is a simple trackball meaning i'm not using euler angles and quaternions or z rotation. we are not flying space ships here just rotating things so sometimes there is no need for pitch roll and yaw from xy coordinates.

if you want that level of complexity or another degree of freedom or maybe more of a stock trackball feeling with exposed orientations just add the inertia from the simple trackball with inertia example presented here to my quaternion trackball located in this repository as it is a direct implementation of Apples trackball.h