JSPM

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

GenArtAPI platform adapter for editart.xyz

Package Exports

    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 (@genart-api/adapter-editart) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @genart-api/adapter-editart

    npm version npm downloads Mastodon Follow

    GenArtAPI platform adapter for the editart.xyz art platform.

    See main README for details.

    Usage

    yarn add @genart-api/core @genart-api/adpater-editart
    
    # create dest dir
    mkdir -p lib
    
    # copy files
    cp node_modules/@genart-api/core/*.min.js lib
    cp node_modules/@genart-api/adapter-editart/*.min.js lib

    If you're a TypeScript user, you'll also want to add the types field in your tsconfig.json:

    tsconfig.json:

    {
        "compilerOptions": {
            "types": ["@genart-api/core", "@genart-api/adapter-editart"]
        }
    }

    In your HTML wrapper, add the following script tags to the <head> to load the core GenArtAPI and the EditArt platform adapter:

    <script src="./lib/genart.min.js"></script>
    <script src="./lib/adapter-editart.min.js"></script>

    See related section in main project README for more details...

    Once running, you can then test your example in the EditArt sandbox:

    https://www.editart.xyz/sandbox

    Parameter handling

    Type adaptations & conversions

    [!IMPORTANT] Parameter adaptation for different platforms is fully invisible to the artwork and no code changes need to be done in the artwork (which is the entire purpose of platform adapters in this system).

    Because EditArt only supports at most 5 number parameters (with slider controls), only the following GenArtAPI param types can be used for projects intended for this platform. Where possible, types will be adapted, and even though the EditArt param UI controls will only ever be sliders, your artwork remain independent from these platform constraints and can still use the original param type intended (e.g. a choice param).

    Params using other types will be ignored and will only ever evaluate to their assigned (or randomized) default values. When using such unsupported types, the platform adapter will log a warning message in the browser console.

    Selection

    This platform adapter only considers parameters with non-private .edit permissions. By default the adapter auto-selects eligible parameters (using fixed ordering rules). However, artists can manually select specific params (as long as they're supported) via an extra configuration step, e.g. by adding another <script> tag to yor HTML wrapper:

    <script>
        // optional: manually specify which params (max. 5) should be exposed
        $genart.adapter.configure({ params: ["a", "b", "c"] });
    </script>

    If params are specified via this mechanism, no others will be considered. An error to be thrown if attempting to list more than 5 params this way.

    Ordering

    To ensure deterministic mapping between the 5 param values exposed by the EditArt platform and the params defined by the artwork, the platform adpater uses the following approach:

    • All non-eligible params (with unsupported types) are ignored (see earlier section)
    • Declared params are sorted by their specified .order as primary sort key and then by their ID as secondary sort key
    • Only the first max. 5 of the sorted parameters are used (mapped to EditArt's m0...m4 params).

    Update behavior

    EditArt doesn't support the concept of live adjustable params and any param change always triggers a full restart of the artwork.

    License

    © 2024 - 2025 Karsten Schmidt // MIT License