PixelCraft

repository·master·Indexed 23 days ago

https://github.com/rgab1508/pixelcraft

A React-based Progressive Web App (PWA) for creating pixel art and animations. It features a variety of drawing tools including a pencil, eraser, paint tool, and shape tools for lines, circles, and ellipses. The application supports frame management for GIF creation, image importing, and exporting as PNG or GIF. Built with Create React App and Chakra UI, it includes a standardized development environment with scripts for testing and production builds.

Tokens
1.7K
Snippets
5
Records
18
Agent score
81%

What's inside pixelcraft

  1. Use Utility and Advanced Tools

    master

    PixelCraft includes several helper tools:

    • Undo/Redo: Corrects small mistakes by undoing or redoing one pixel at a time.
    • Clear Window: Clears the entire current canvas.
    • Import Image: Converts an existing image into pixel art based on your chosen canvas dimensions.
  2. Export Pixel Art and GIFs

    master

    Once your work is complete, you can export it using the dropdown menu:

    • Save Image: Downloads the current canvas as a canvas.png file. The output dimensions are scaled by 10 (e.g., a 16x16 canvas results in a 160x160 image).
    • Save GIF: Exports the current Frame Stack as a GIF file. The GIF dimensions will match the canvas dimensions.
  3. Eject from Create React App configuration

    master

    If you need full control over the underlying build tools (webpack, Babel, ESLint, etc.), you can run yarn eject.

    Warning: This is a one-way operation. Once you eject, you cannot undo it.

    Running this command removes the single build dependency and copies all configuration files and transitive dependencies directly into your project. While all other commands will still work by pointing to these new local scripts, you will be responsible for managing the configuration yourself.

    yarn eject
  4. Install PixelCraft as a PWA

    master

    Since PixelCraft is a fully compatible Progressive Web App (PWA), you can install it for offline use:

    1. Open the app in your browser.
    2. Use the option in the top-left dropdown menu to install, OR
    3. Use the "Add to Home Screen" button from your browser's options.
  5. Manage Color Palette and Transparency

    master

    Use the color palette to select colors for your art:

    • Select Color: Click on any color in the palette.
    • Set Transparency: Right-click on a color to set its transparency value between 0 and 1. This allows for creating translucent colors and complex patterns.
  6. Build the production application with `yarn build`

    master
    To prepare your application for production, run yarn build. This command creates a build folder containing the optimized, minified production assets. The build process includes React in production mode and uses file hashing for filenames to assist with caching and deployment.
    yarn build
  7. Use Drawing and Shape Tools

    master

    PixelCraft provides several tools for creating art:

    • Pencil: Draws pixels freehand.
    • Eraser: Erases a single pixel (fixed 1x1 dimension).
    • Paint Tool: Performs a flood fill to change a color area to a new color (works best under 128x128).
    • Line Tool: Draws a line segment between two points using the Bresenham algorithm. Click the tool, then click two points on the canvas.
    • Circle Tool: Draws a circle with a given center and radius using the Midpoint Circle Algorithm.
    • Ellipse Tool: Draws an ellipse with a given center and specific radii along the x and y axes.
  8. Create GIF Animations with Frame Tools

    master

    To create animations, use the GIF Tools to manage a stack of frames:

    • Add Frame: Captures the current canvas state and adds it to the Frame Stack. Each frame is added with a default delay of 100 ms. To increase the duration of a specific frame in the final GIF, add the same frame multiple times.
    • View Frame: Opens a popup displaying all current frames in the stack.
      • Load a Frame: Click on a frame in the popup to load it back onto the canvas.
      • Delete a Frame: Right-click (or long-press on mobile) a frame in the popup to remove it.