# Editable keyframe curves

Any suggestions for a good approach to implementing a zoomable 'keyframe' based curve editor? Essentially, something akin to the functionality of the graph editor in animation packages such as Maya. (see here).

I can see how to get started on something simple using Locators, but the ability to zoom and pan on long time ranges is something that looks tricky to me, and I suspect starting out with the right concept in the first place will save a lot of headaches...any ideas much appreciated.

-
You might be able to use this as a starting point. – J. M. Aug 16 '12 at 13:58
Maybe a concept like InteractiveTradingChart ? – b.gatessucks Aug 16 '12 at 15:49
Heike's interactive curve drawing machine: mathematica.stackexchange.com/questions/4179/… – cormullion Aug 16 '12 at 17:52
zooming and panning perhaps covered here:mathematica.stackexchange.com/a/7144/57 – Sjoerd C. de Vries Aug 16 '12 at 22:23

You seem to be under the impression that writing an interface like that in Mathematica takes a lot of time. In fact Mathematica is a very good tool for rapid prototyping of such interfaces, and it's often fruitful not to think about how much time one could potentially waste and just try it.

I believe that your question about zoom and panning has already been answered here. The key to both zooming and panning is to control PlotRange. This can be done in different ways. Below is a very simple example and the link provides more advanced methods. I'm using LocatorPane as was suggested in the comments. Interpolate finds the curve that ties the locators together:

Manipulate[
LocatorPane[
Dynamic[pts],
Dynamic@Plot[
InterpolatingPolynomial[pts, x], {x, offset, offset + width},
PlotRange -> {{offset, offset + width}, {0, 10}}
],
LocatorAutoCreate -> True
],
{{offset, 0, "Offset"}, 0, 50},
{{width, 10, "Width"}, 1, 50},
Initialization :> (
pts = {{0, 0}};
)
]


-