I'm making an iOS app for sound synthesis. And I need a custom slider by which user can adjust the sound frequency. The slider has unique design - wave form (an example is shown in the picture).
How to make slider with complex curve?
I'm making an iOS app for sound synthesis. And I need a custom slider by which user can adjust the sound frequency. The slider has unique design - wave form (an example is shown in the picture).
How to make slider with complex curve?
12pm - I can't think of any immediately obvious, simple, way to do this in iOS. I'd look around for a package and if you're lucky there will be one! Otherwise it's just a case of plain hard programming.
You may possibly have to use beziers (Find the tangent of a point on a cubic bezier curve) to define the travel path. Or maybe, "simply" two half-circles.
From there use a "normal" slider concept to get the X position of the finger, but just position the "y" value of the red ball, per your equations. That will work OK.
For a better approach (I doubt it will be necessary), the NEXT more complicated approach is: ALSO note the Y value of the finger. WHEN THE FINGER IS NEAR the "difficult" parts", THEN INSTEAD consider the Y value. Do you see what I mean?
Finally the "ultimate solution" .. you need to get in to finding the "closest point on a curve" (i.e., give some point). This is classic game programming math. So follow something like
http://hal.archives-ouvertes.fr/docs/00/51/83/79/PDF/Xiao-DiaoChen2007c.pdf
Check out any of these classic books for that type of thing
http://www.amazon.com/Mathematics-Programming-Computer-Graphics-Edition/dp/1435458869
http://www.amazon.com/Real-Time-Collision-Detection-Interactive-Technology/dp/1558607323
However, IMO it would be "thoughtless engineering" .. .solution "A" or "B" is typically perfect!