public static void AddAnimatedContainer(AnimatedLayoutContainer container)
 {
     animatedContainers.Add(container);
     if (animatedContainers.Count == 1)
     {
         timer.addUpdateListener(updater);
     }
 }
        public static void RemoveAnimatedContainer(AnimatedLayoutContainer container)
        {
            int index = animatedContainers.IndexOf(container);

            if (index != -1)
            {
                animatedContainers.RemoveAt(index);
                //Adjust the iteration index backwards if the element being removed is before or on the index.
                //This way nothing gets skipped.
                if (index <= updateIndex)
                {
                    --updateIndex;
                }
            }

            if (animatedContainers.Count == 0)
            {
                timer.removeUpdateListener(updater);
            }
        }