Using ComponentAnimator

Hello,
i have a TabbedComponent with some buttons, on button click i am adding new Tabs as there in a Web Browser, i am facing a problem on moving the Tabs from one position to different position with animation effect as it is on Google chrome, or Mozilla. The Tab should automatically place itself to the position if i drag the tab half way left or right. I made use of DragAndDropTarget and i am able to move the tabs from one place to another , but not getting the special effect. Can u tell if it can be done using ComponentAnimator.

It’s the kind of thing the component animator would be used for, but the existing TabbedComponent doesn’t support animation, sorry.

Yea, u are right. But is there any other way to achieve that kinda effect for tabs ?

There’s nothing in the library that would do it for you, you’d need to write your own component for it.

Thanks Jules, As u said me to write my own Component class, now I am able to animate and Slide MyTabbedComponent (Child of TabbedComponent) using Component Animator.

void MyTabbedComponent :: mouseDrag(const MouseEvent& event)
{
int xCord = 180;
int YCord = 0;
int width = getWidth();
int height = getHeight();

Rectangle <int>  finalBounds(xCord, YCord, width, height);
Desktop::getInstance().getAnimator().animateComponent(this, finalBounds,1.0f,1000,true,1.0f,1.0f);

}

But all the Tabs are moving together , I need to move tabs one-by-one. Not getting how to do it , becas’ animateComponent requires the full component as its parameter , and not individual tabs that i want to animate.

1 Like

Finally Tabs are moving :

Desktop::getInstance().getAnimator().animateComponent(this->getChildComponent(0)->getComponentAt(/tab XCord/,0),
finalBounds,1.0f,1000,true,1.0f,1.0f);

1 Like