Code Monkey home page Code Monkey logo

ascii-fluid's Introduction

๐ŸŒŠ ascii-fluid

ascii-fluid is a face controlled ASCII fluid simulation running real time in your terminal. You can control the fluid dynamics with your face by using a webcam, but also with your mouse or touchpad.

ascii-fluid

Usage

 $ go get -u -v github.com/esimov/ascii-fluid
 $ cd wasm && make

How does it works?

The fluid solver is mainly based on Jos Stam's paper Real-Time Fluid Dynamics for Games. tcell library is used for rendering the fluid simulation in terminal and gorrilla/websocket package for communicating through a websocket connection with the Webassembly version of the Pigo face detection library.

This will start three new operation simultaneously:

  • open a new terminal window
  • start a new web server which is listening on the incoming websocket connection
  • build the webassembly interface for accessing the webcam.

The coordinates of the first detected face will be transferred over the websocket connection to the terminal application. On each refresh rate (defined as a parameter) the terminal will update the fluid simulation.

OS Support

This program has been tested on Linux and MacOS, but normally it should also run on Windows.

Because of the OS imposed security constrains there are some important steps you need to take:

MacOS:

In MacOS you must set the accessibility authorization for the terminal you are running from.

Controls

  • CTRL-D show/hide the grid system
  • TAB + mouse down activate/deactivate agents (agents generates repulsions).

Dependencies

Author

License

Copyright ยฉ 2020 Endre Simo

This software is distributed under the MIT license. See the LICENSE file for the full license text.

ascii-fluid's People

Contributors

esimov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ascii-fluid's Issues

Cannot reproduce the effect

Hi Endre,

I tried to use your code, and had successfully opened the browser's webcam, seeing a bounding box around my face; and the terminal, with a lot of dots on it.โ€”โ€”But they don't interact. I don't see the movement of my face reflects on the terminal. Meanwhile, the mouse click can render the fluid moving. I tried on my and my friend's Macbook Pro (both go 1.16.5), both don't work. Do you have any ideas?

By the way, with go modules, your Makefile should have a revision in line 13: from COMMAND = osascript -e 'tell app "Terminal" to do script "go run $(PARENTDIR)/main.go"' to COMMAND = osascript -e 'tell app "Terminal" to do script "cd $(PARENTDIR) && go run main.go"'

Uncaught Error: Go program has already exited

I used the newest version of ascii-fluid, and it seems after a certain time period, the rendered video would suddenly stuck, and the browser would throw this error:
"Uncaught Error: Go program has already exited
at global.Go._resume (wasm_exec.js:576)
at wasm_exec.js:589".

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.