benjaminaaron / GraphVisualizer

a simple graph visualizer to get into things around graphs
0 stars 0 forks source link

simplifying the timeline class #10

Open benjaminaaron opened 11 years ago

benjaminaaron commented 11 years ago

I think it would make things easier if the timeline-class would only store one ArrayList of Keyframes. In there the short/level/node-wise ones would be thrown together but be identifiable by a keyframe-id. An expansion-method would then later pull out the keyframes for the animation that is asked for and build some interim-frames between the keyframes (or not in the case of "none" animation-mode). In case of the "short" animation-mode it would just take the first and the last keyframe and build interim-frames between those two.

ghost commented 11 years ago

Maybe it would be good to add the time between each key frame to the timeline class. I think it would be a good idea to think of the different animation algorithms as timeline generators. That means they all implement an interface TimelineGenerator that has a method generateTimeline. Then the Timeline class has no dependency on a specific animation algorithm. I think that would be good, because adding new animation algorithms should be easier then.

benjaminaaron commented 11 years ago

That's a great idea, by adding time between keyframes we could create animation that slow down or speed up along the way - is that what you have in mind? When you have a chance, maybe you can check out the new Timeline and AnimationProduction classes - i think that is along the lines of what you meant with thinking of the anim-algos as timeline generators, no? Since they are so short i made them methods instead of individual classes that implement an interface. Do you think it would be better to make classes and put them into a subpackage of the model-package for instance?

ghost commented 11 years ago

I had a quick look over your new changes.

anim-algos as timeline generators

Yes. That's what I meant.

That's a great idea, by adding time between keyframes we could create animation that slow down or speed up along the way - is that what you have in mind?

Yap, any kind of non-linear animation.

Do you think it would be better to make classes and put them into a subpackage of the model-package for instance?

Yes, I think that is a better approach, because you can use the animation algorithms independently and the object that uses a animation algorithm must not be aware which animation algorithm it uses (because it just uses the interface :-)). If you have some utility methods that are shared between all animation algorithms, you can create an abstract base class that just implement those utility methods (additionally to the interface).

benjaminaaron commented 11 years ago

Non-linear animation... i like that :) I will add an object-variable like "framesBtwnKeyframeFactor" in the Frame class that will be multiplied with the default-value when the timeline object is tasked with creating frames between the keyframes. I think a factor is better than an absolute value - in that way i can still speed or slow down the whole thing with one slider, even so it has different "timezones" (as in number of frames between keyframes).

Ok, cool, i will try to mimic the structure you used for the layout classes for the animationProduction classes. An abstract base-class with the utility methods sounds great too!

benjaminaaron commented 11 years ago

Did i do it sort of like you had in mind? Not feeling secure yet with the abstract class / interface stuff. Time-variable for frames is also in place now, check out the "rotating circle" to see it in action ^^

ghost commented 11 years ago

The new animation modes are very cool ;-) You did it exactly how I would have done it, I would name the producers a bit short. "HorizontalBottomUp" for "ProduceHorizontalBottomUpTimeline" for example.

benjaminaaron commented 11 years ago

Thanks. I'd like to do some more fancy animations with rotating spirals and other effects at some point :) Glad to hear you would have done it the same way. That is probably because i looked closely how you did it with the Layout Algorithms ;) just that there is (currently) no abstract base class.

Actually... i am wondering if the timeline class is still needed :D Abstract class AnimationProducerBase could just as well be equipped with the placeStepsBtwnKeyframes-method that is currently in the Timeline and then deliver the finished ArrayList to the GraphPanel/Animator to show frame by frame...
But maybe a timeline-object is still good from a conceptual point of view even so not necessary?

ghost commented 11 years ago

Yeah, I also think that placeStepsBtwnKeyframes should be moved to the AnimationProducerBase or the Animator.

I don't know if Timeline is needed. Maybe you want take some inspiration from other animation libraries (for uses of a Timeline object).