Java 遊戲程式設計:動畫 ( Java Game Programming: Animation )
在用程式語言製作動畫之前,要了解電腦如何產生動畫,可參考此連結:動畫簡介。
Before creating a computer animation with a programming language, the concept:"how a computer produces animations" have to be understood.
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:
若您覺得文章寫得不錯,請點選文章上的廣告,來支持小編,謝謝。
If you like this post, please click the ads on the blog. Thank you very much.
If you like this post, please click the ads on the blog. Thank you very much.

留言