search

Home  >  Q&A  >  body text

Game Development - How to understand animation (Model) in MVC?

In MVC, the data is stored in the Model, and the View is rendered based on the Model's data. This is the big idea.
But for animation, some states will be generated during the gradient process, and these states do not belong to the Model to some extent.
For such needs, how does the MVC model solve the problem?
If MVC is not used, how can such a technology solve the problem?

巴扎黑巴扎黑2747 days ago442

reply all(1)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-16 17:08:27

    The data in the Model is generally the final result of the View. The various states of the animation should generally not exist in the Model, so the animation should have nothing to do with the Model.

    I think animation control can be done either in View or Controller. For example, CSS transition is essentially a View that performs tweening animations based on data changes; another example is using jQuery's animation function to directly play a small animation after modifying the DOM state, which is controlled at the Controller layer. Both approaches have their own advantages. Putting it in the View is more concise, but the logic should not be too complex and must be very general. Putting it in the Controller is more flexible, but there will be extra code. The actual choice depends on what is more convenient.

    reply
    0
  • Cancelreply