The config argument passed to TwistyPlayer when calling the constructor. This interface type be useful for avoiding bugs when you would like to create a TwistyPlayer using a dynamic config, or by combining configs.

import { TwistyPlayer, type TwistyPlayerConfig } from "cubing/twisty";

const MY_DEFAULT_CONFIG: TwistyPlayerConfig = {
puzzle: "megaminx",
alg: "R U R'"
};
export function createTwistyPlayer(overrideConfig: TwistyPlayerConfig) {
const options = { ...MY_DEFAULT_CONFIG, ...overrideConfig };
return new TwistyPlayer(options);
}

// Example: if the current page is https://alpha.twizzle.net/edit/?alg=M2+E2+S2
// then this gives us the "alg" param value "M2 E2 S2".
const myOverrideConfig: TwistyPlayerConfig = {};
const algParam = new URL(location.href).searchParams.get("alg");
if (algParam) {
myOverrideConfig.alg = algParam;
}
createTwistyPlayer(myOverrideConfig);
interface TwistyPlayerConfig {
    alg?: string | Alg;
    background?: BackgroundThemeWithAuto;
    backView?: BackViewLayoutWithAuto;
    cameraDistance?: number;
    cameraLatitude?: number;
    cameraLatitudeLimit?: number;
    cameraLongitude?: number;
    colorScheme?: ColorSchemeWithAuto;
    controlPanel?: ControlPanelThemeWithAuto;
    experimentalCompetitionID?: string;
    experimentalDragInput?: "auto" | "none";
    experimentalHintSprite?: null | string;
    experimentalInitialHintFaceletsAnimation?: InitialHintFaceletsAnimation;
    experimentalMovePressCancelOptions?: AppendCancelOptions;
    experimentalMovePressInput?: "basic" | "auto" | "none";
    experimentalPuzzleDescription?: string;
    experimentalSetupAlg?: string | Alg;
    experimentalSetupAnchor?: "end" | "start";
    experimentalSprite?: null | string;
    experimentalStickering?: string;
    experimentalStickeringMaskOrbits?: string | StickeringMask;
    experimentalTitle?: null | string;
    experimentalVideoURL?: string;
    hintFacelets?: HintFaceletStyleWithAuto;
    puzzle?:
        | "custom"
        | "2x2x2"
        | "3x3x3"
        | "4x4x4"
        | "5x5x5"
        | "6x6x6"
        | "7x7x7"
        | "40x40x40"
        | "skewb"
        | "pyraminx"
        | "megaminx"
        | "gigaminx"
        | "square1"
        | "clock"
        | "fto"
        | "master_tetraminx"
        | "kilominx"
        | "redi_cube"
        | "melindas2x2x2x2"
        | "tri_quad"
        | "loopover";
    tempoScale?: number;
    viewerLink?: ViewerLinkPageWithAuto;
    visualization?: VisualizationFormatWithAuto;
}

Properties

alg?: string | Alg
background?: BackgroundThemeWithAuto
backView?: BackViewLayoutWithAuto
cameraDistance?: number
cameraLatitude?: number
cameraLatitudeLimit?: number
cameraLongitude?: number
colorScheme?: ColorSchemeWithAuto
controlPanel?: ControlPanelThemeWithAuto
experimentalCompetitionID?: string
experimentalDragInput?: "auto" | "none"
experimentalHintSprite?: null | string
experimentalInitialHintFaceletsAnimation?: InitialHintFaceletsAnimation
experimentalMovePressCancelOptions?: AppendCancelOptions
experimentalMovePressInput?: "basic" | "auto" | "none"
experimentalPuzzleDescription?: string
experimentalSetupAlg?: string | Alg
experimentalSetupAnchor?: "end" | "start"
experimentalSprite?: null | string
experimentalStickering?: string
experimentalStickeringMaskOrbits?: string | StickeringMask
experimentalTitle?: null | string
experimentalVideoURL?: string
hintFacelets?: HintFaceletStyleWithAuto
puzzle?:
    | "custom"
    | "2x2x2"
    | "3x3x3"
    | "4x4x4"
    | "5x5x5"
    | "6x6x6"
    | "7x7x7"
    | "40x40x40"
    | "skewb"
    | "pyraminx"
    | "megaminx"
    | "gigaminx"
    | "square1"
    | "clock"
    | "fto"
    | "master_tetraminx"
    | "kilominx"
    | "redi_cube"
    | "melindas2x2x2x2"
    | "tri_quad"
    | "loopover"
tempoScale?: number
viewerLink?: ViewerLinkPageWithAuto
visualization?: VisualizationFormatWithAuto