matrix class and animation