Book Image

Kivy Blueprints

Book Image

Kivy Blueprints

Overview of this book

Table of Contents (17 chapters)
Kivy Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The Python Ecosystem
Index

Making the Starfield app


Armed with our newfound knowledge of GLSL, let's build a starfield screensaver, that is, a non-interactive demonstration of stars fleeing from the center of the screen to its sides, under the influence of an imaginary centrifugal force or something.

Tip

As dynamic visual effects are hard to describe unequivocally and screenshots aren't very helpful in this regard either, run the code that accompanies the chapter to get a better idea of what's going on.

Conceptually, each star goes through the same action sequence:

  1. It spawns randomly near the center of the screen.

  2. The star moves in the opposite direction from the screen center until it's no longer visible.

  3. Then it respawns, going back to square one.

We will also make stars accelerate and grow in size as they approach the edges of the screen to simulate the faux depth.

The following screenshot attempts (or, to be more specific, fails due to the highly dynamic nature of the demo) to illustrate what the end result will look...