Qt Kinetic + Plasma Call For Ideas / Project Plan

Ivan Čukić ivan.cukic at gmail.com
Fri May 29 09:53:25 CEST 2009


> in which case an API like this:
>
> Animation a(item);
> a.add(animator.fadeIn());
> Animation b;
> b.setParallel(true);
> b.add(animator.blur(0.8));
> b.add(animator.bounce(4));
> a.add(b);
> a.addPause(10); // a.add(animator.pause(10));?
> a.add(animator.fadeOut());
> a.run(250); // builds the qt animation objects and runs it all

This starts to look like something. But I would propose an addition.
1 - that add returns a reference to the Animation object so that the following 
is possible:
     b.add(animator.blur(...))
       .add(animator.bounce(...))
or with << operator (like QList...)
     b << animator.blur(...)
        << animator.bounce(...)

2 - to have static 'constructors' Animation::series(item) and 
Animation::parallel(item), or, even better, just to have the Animation::Type 
enum (Parallel, Serial) passed to the constructor
     Animation a(item, Animation::Parallel)

With the solution above, we could have it /both ways/ the way that is clearer 
to you (Aaron) and the way it is clearer for me while having no additional 
API.

For the example, go to the end of the mail. :)

> starts to look not bad as that would be the "degenerate" case with this
> being a more common case:
>
> Animation a(item1, item2);
Vararg or a list or a different constructor for any fixed number of args?

> but anything more complex feels like shooting a mouse with an elephant gun.
> we have DUI coming for that. ;-P

Cheers.

---
Example

Aaron's way:

   Animation a(item);
   a.add(animator.fadeIn());
   Animation b;
   b.setParallel(true);
   b.add(animator.blur(0.8));
   b.add(animator.bounce(4));
   a.add(b);
   a.addPause(10); // a.add(animator.pause(10));?
   a.add(animator.fadeOut());
   a.run(250);

A bit modified Aaron's way

   Animation b(item2, Animation::Parallel);
      b << animator.blur(0.8)
         << animator.bounce(4);
   Animation a(item);
      a << animator.fadeIn()
         << b
         << animator.pause(10);
         << animator.fadeOut();
   a.run(250);

Or my way:

   Animation b(item2, Animation::Parallel);
      b << animator.blur(0.8)
         << animator.bounce(4);
   Animation a(item);
      a << animator.fadeIn()
         << (
                 Animation(item2, Animation::Parallel)
                        << animator.blur(0.8)
                        << animator.bounce(4);
         )
         << animator.pause(10);
         << animator.fadeOut();
   a.run(250);



More information about the Plasma-devel mailing list