Git Product home page Git Product logo

mircle's Introduction

Mircle

A website that generates line art by multiplying in a circle. See it here.

How Does It Work?

The core concept is best explained by Mathologer, whose video inspired this whole project.

To summarize, arrange n vertices in order around a circle. Choose some multiplier m. For each vertex v, multiply it by m and apply modulo n to get a new vertex v2. That is, v2 = (v * m) mod n. Draw a line between these vertices. The resulting graph has exactly n lines.

Example showing 100 vertices with multiplier 2.

That's all been done before, but what if we layer a bunch of these graphs over each other? Let's restrict m to integers less than n. For each m, compute the graph as before, but keep track of repeated lines. As more layers define the same line, draw it more prominently.

Example showing 100 vertices with all 100 layers stacked.

To further accentuate the patterns, we can use color, opacity, and width to individually style each line. Add a few gradients and we have art!

Example showing the same graph with styles applied.

Thus we can visualize the inherent beauty of numbers and multiplication.

Browser Compatibility

Slight variations between browsers in their implementation of the HTML5 canvas may cause the image to render differently. And in the case of Safari, different to the point of not working :(

Chrome Firefox Safari (broken)

mircle's People

Contributors

moarram avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.