Git Product home page Git Product logo

epicycles's Introduction

Drawing shapes with epicycles

This app lets you draw any 2d shape using a combination of circles with different radii and rotation speeds. For more info see this Video by The Coding Train or this Video by Mathologer.

heart
closed hilbert curve

Requires Python >= 3.6, PyGame 2 and NumPy.

To run the app you can provide a path to a text file containing the points of the desired shape:

python epicycles.py shapes/heart.txt

If you run it without a file path then the app will go into "draw" mode. There you you can draw a shape with the mouse. Then hit enter to watch the circles go.

Controls

Action Binding
Pause/unpause Space
Erase the line Backspace
Toggle line fading F
Toggle visibility of the circles C
Increase speed +
Decrease speed -
Reverse rotation R
Switch between the circles and the drawing mode Enter
Toggle debug mode F1
Quit Esc

Optional Command Line Arguments

  • -h, --help: Show a help message and exit.
  • -n <int>: Limit the maximum number of circles.
  • -s, --scale <float>: A number > 0 and <= 1 indicating how much of the width and height of the window the shape should occupy. To disable scaling set it to 0.
  • -f, --fade: Fade the line color over time so that it vanishes after one cycle.
  • -r, --reverse: Reverse the rotation direction.
  • -p, --paused: Start the app paused.
  • -w, --window-size <width> <height>: Specify a custom window width and height in pixels.
  • -d, --debug: Start the app in debug mode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.