Hello there,
I have an audio plugin that has a button that when clicked will expand the window size and show a component will extra controls on it. Calling setsize in the editor does this perfectly but it would be nice if I could animate the resizing so the window grows/shrinks when the button is clicked.
I’ve attempting this using the timerCallback function (shown below) to gradually resize the window however the window turns white until the animation is complete. I’ve timed the resized function and it’s only taking 1 millisecond to repaint the GUI and the timerCallback is being called every 20 milliseconds so there should be enough time to repaint the GUI.
Could anyone tell me why my GUI can’t keep up? Or maybe know a better way of animating a plugin window size altogether?
void UIHolder::timerCallback()
{
int currentWidth = getWidth();
//animate window getting larger
if (currentWidth < PLUGIN_WIDTH_EXPANDED)
{
m_pluginEditor->setSize(currentWidth + m_animationStep, PLUGIN_HEIGHT);
resized();
}
//animate window getting smaller
else if (currentWidth > PLUGIN_WIDTH_NORMAL)
{
m_pluginEditor->setSize(currentWidth - m_animationStep, PLUGIN_HEIGHT);
resized();
}
else
{
stopTimer();
}
}
