Code Monkey home page Code Monkey logo

marbling-experiment's Introduction

Marbling Experiment

An early experiment toward building a marbling simulation. This code was originally written in 2017 in the class The Nature of Mathematical Modeling. I've recently refactored the code using gpu-io so that it can run on pretty much any platform/browser. This demo is embedded in my blog post about digital marbling.

Performance

This application will run any device/browser supporting WebGL2 or WebGL1.

The simulation doesn't start running until a pointerdown/pointermove event is detected on the canvas. After 15 seconds without interaction, the simulation pauses until another pointerdown/pointermove event is detected on the canvas. More info about animation loop can be found in src/index.ts.

Use

To embed this simulation in a page with an iframe:

<!-- iframe can be any width and height -->
<iframe style="width:800px;height:500px;border:none;background-color:#cccccc;" src="https://apps.amandaghassaei.com/marbling-experiment/"></iframe>

Embedding with a fixed aspect ratio on a responsive layout:

<!-- 56.25% gives a 16:9 aspect ratio -->
<div style="padding:56.25% 0 0 0;position:relative;">
  <iframe src="https://apps.amandaghassaei.com/marbling-experiment/" style="position:absolute;top:0;left:0;width:100%;height:100%;background-color:#cccccc;" frameborder="0">
  </iframe>
</div>

An example of embedding this page with an iframe is currently hosted at apps.amandaghassaei.com/marbling-experiment/embed/

A sample page with a full-screen simulation is currently hosted at apps.amandaghassaei.com/marbling-experiment/

Compiled js code is in dist/index.min.js

Development

To install all development dependencies, run:

npm install

To build src to dist, run:

npm run build

License

This work is licensed under an MIT License. Note that it depends on the following:

Testing

This application is built on top of gpu-io, which has been extensively tested in a variety of device/browser combinations. All functionality is supported by both WebGL2 and older browsers that only support WebGL1.

marbling-experiment's People

Contributors

amandaghassaei 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.