Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Vector Toy – Visualize and manipulate vector field functions (dandelany.github.io)
43 points by dandelany on Feb 19, 2016 | hide | past | favorite | 4 comments



Hi! This is a side project I've been working on for a couple weeks, inspired by the famous Nullschool Earth wind map.[1] I wanted to implement the same style of visualization for arbitrary 2D vector field functions, and to do so in a way that allows you to experiment with the functions direct-manipulation-style in the browser. Hope you enjoy playing with it as much as I do :) A few notes:

- The code is available on Github [2], bugs/feature requests/PRs welcome.

- High-quality renders can be made by setting Fade to zero, # of Particles to a high number, and Line Width to a low number.

- Add interactivity easily by using the globals `mouseX` and `mouseY` in the vector functions, which represent the mouse cursor's current X and Y coordinates in the field's coordinate system (not pixel coords).

- The URL contains all of your settings, so you can share what you make by using the built-in link shortener at the top. Note that these links allow execution of arbitrary JS, so be aware that links from others may crash your tab or redirect you somewhere else. Never host this code on a domain where XSRF-style attack could be a concern.

- Some challenges, for the adventurous... Try to make a human face or figure, a Starry Night styled sky, or a realistic cross section of a fruit. Then send it to me so I can include it as one of the default presets, since I failed to make them myself :)

[1] http://earth.nullschool.net/ [2] https://github.com/dandelany/vector-toy



Including mouseX and mouseY in the functions is fun.


Looks awesome! +1




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: