Jump in the pit and add something new!
By adding a new mode, you will be creating a new file which exports a function that manipulates data extracted from a source image's bitmap. That may sound like a lot, but it'll essentially come down to basic iteration over a buffer. Starter code has been provided here.
Your mosh mode doesn't have to do anything specific -- if you think it's cool, we probably will too. Use your imagination and feel free to experiment!
Most of Datamosh's current modes overwrite existing Red/Green/Blue (RGB) pixel values with something random. If you get stuck or just need some inspiration, check out these examples.
Once you have a stub function and some cool name for it, you'll want to import it into Datamosh.
To import your mode, you have two options:
- Import it into Datamosh by adding an entry in
mosh.MODES
, here. (Preferred) - Add it to the function property after you initialize Datamosh. Example code on how to do this can be found here.
-
Fork datamosh and run
npm install
within the directory. -
On your fork, create a new branch named
username/work-description
, whereusername
is your GitHub username andwork-description
is a short description for your contribution.For example:
mster/new-mode
-
Commit your work to the branch you created.
-
When you're ready for review or to submit your contribution, double check a few things.
-
✓ First, make sure your fork is up to date. If your fork is out of date, you will need to rebase.
-
✓ Next, assure that your code pases
npm test
.
- If you contribution is more than a single commit, squash all commits into one.
- Open a pull request to
mster:master
.
Have an feature in mind? Go for it -- if we like it, we will add it.
Follow the Getting Started guide if you're new to this.
Datamosh uses StandardJS. To have your contributions accepted, they must also be in StandardJS style.
To test if your code passes, run the test command:
npm run lint
As of v1.0.0, tests consist of:
- linting using StandardJS
We're happy to help out, no matter how small. Open an issue, ping the author (@mster), or join the Discord.
Datamosh has a dedicated Discord server. Feel free to join: https://discord.gg/DhYTmMD