JSPM

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

Generate rubik's cube scramble images

Package Exports

  • cube-preview

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 (cube-preview) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Cube Preview

License: MIT code style: prettier

Node.js

yarn add cube-preview
# or
npm install cube-preview
const { CubePreview } = require('cube-preview');

const threebythreePreview = new CubePreview(); // Defaults to 3x3

console.log(
  threebythreePreview
    .setColorScheme({ R: 'pink' })
    .svgString('RBLUULUBFRBDBRRBRFFDDFFRLFDBULDDFDLRURLLLDBLUFUBDBUUFR')
); // Returns the svg string matching the given state, with pink instead of red

scramble

API

.svg(state); // Return the svg string matching the given state
.setType(type); // Set the type, defaults to 333 (Valid types: 222, 333, ..., NNN)
.setCubieSize(num); // Set the cubie size, defaults to 20
.setSpacing(num); // Set the spacing between each side, defaults to 2
.setColorScheme(object); // Set the color scheme

defaultColorScheme = {
  U: 'white',
  R: 'red',
  F: 'green',
  D: 'yellow',
  L: 'orange',
  B: 'blue',
};

Status

Works for all NxNxNs.

Only output svg Strings.

Contribute

Pull requests are welcome!