The ‘Attributes’ struct has all the attributes that any object in my library can have. Using these attributes we can animate the object. For example if we change the ‘x’ and ‘y’ of an element its position will change. Each attribute has its own get and set functions eg ‘get_color’ and ‘set_color’ for ‘color’ attributes. when the library becomes more complex all the logic for changing attributes will be placed in these getter and setter functions.
This is one of the Object in my library that implements the ‘Animatable’ trait. In future there will be more
When we animate an attribute of a Type the result (the new created value) can be a String a bool a float or any mixture of these. In rust when ever you want to send back multiple types of data from “A” function you have to create an Enum of all the possible return data types. These are all the possible accepted legit results from ‘animate’ function.
The ‘Animatable’ is the main trait that is to be implemented by any object in my library if it wants to be animated.The ‘Animatable’ trait can be implemented by any Type. It means that the said object will take the value of one of the attributes (given in ‘AttributesEnum’) and animate it (as it feels fit) and return result. While calling the ‘animate()’ we do send it the current time ( time from the start of the animation) but it is totally upto the implementation of the trait user if he wants to make use of this time or not.