Java 遊戲程式設計:動畫 ( Java Game Programming: Animation )
1 min readFeb 7, 2019
在用程式語言製作動畫之前,要了解電腦如何產生動畫,可參考此連結:動畫簡介。 Before creating a computer animation with a programming language, the concept:”how a computer produces animations” have to be understood.
那麼要如何在Java裡要產生動畫?利用Timer就可以了。
The Java programming has a Timer class that can generate animations.
底下了範例是用Swing Timer來實現將螢幕上的東西從左移動到右。
The following example use Swing Timer to move a square from the left to the right of the screen.
程式碼如下: The code is:
Originally published at yunlinsong.blogspot.com on February 7, 2019.