How to slowly change object color from one to another?

前端 未结 6 1710
迷失自我
迷失自我 2020-12-02 01:38

I am trying to achieve a scenario where the color of an object changes slowly from one color to another color.

I have the initial color as targetColor and final col

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-02 02:24

    I wouldnt rely on a specific delay time to compute the next step in an animation as this will certainly provide different execution times in different machines, although it might not be a relevant difference.

    Instead of a changing speed factor your could use a long representing the animation total time and use a Thread (or another multithreading mecanism) to control the animation lifecycle (such as calculating how much time has passed since the last repaint and whats the percentage of completion for the next iteration).

提交回复
热议问题