JSPM

@rlxyz/compiler

1.0.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q26082F
    • License MIT

    A library based on Boolean Logic for generative art compilation

    Package Exports

    • @rlxyz/compiler
    • @rlxyz/compiler/build/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rlxyz/compiler) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    NPM Package

    A library based on Boolean Logic for Generative Art compilation

    • Allows creation of generative art images based on layers
    • Handles various boolean logic creation
    • Outputs metadata files
    • Calculates rarity of each layer & trait

    Overview

    Installation 🛠️

    yarn add @rlxyz/compiler

    Once installed, you can use the generative compiler in the library by following these steps.

    Usage

    Step 1: Create folder in root of project called layers and add layers.

    root
      - src
      - layers
        - layer_1
          - layer_1_1.png
          - layer_1_2.png
        - layer_2
          - layer_2_1.png
          - layer_2_2.png
      - package.json
      - ...

    Step 2: Set these variables.

    const imageFormatConfig: ImageFormatConfig = {
        width: 500,
        height: 500,
        smoothing: false,
    }

    Step 3: Create these folders at root

    root
      - layers
      - images
      - metadata
      - package.json
      - ...

    As of v1.0.1, user must create layers, images and metadata folder.

    Step 4: Layer Config based on layers folder

    const layerConfig: LayerConfig[] = [
      {
        name: 'layer_1',
        traits: [
          { name: 'layer_1_1.png', weight: 50 },
          { name: 'layer_1_2.png', weight: 100 },
        ],
      },
      {
        name: 'layer_2',
        traits: [
          { name: 'layer_2_1.png', weight: 70 },
          { name: 'layer_2_2.png', weight: 30 },
        ],
      },
    ];

    Step 5: To generate images, use this block of code.

    import { Layers } from '@rlxyz/compiler';
    import { imageFormatConfig, layerConfig } from './config';
    
    const basePath = process.cwd();
    
    const createImage = () => {
      const layers = new Layers(layerConfig, imageFormatConfig, basePath, true);
      layers.createRandomImages();
    };
    
    (() => {
      createImage();
    })();

    Security

    This project is maintained by RLXYZ.

    Critical bug fixes will be backported to past major releases.

    Contribute

    RLXYZ Compiler exists thanks to its contributors. There are many ways you can participate and help build high quality software. Check out the contribution guide!

    License

    RLXYZ Compiler is released under the MIT License.