本文へ移動

Kyuubuキューブ

CSS 3Dのキューブをタッチ、キー、回転記号で回します。シードでスクランブルを再現し、名前付きの手順で解き方を追えます。

「キューブ」は、英語のcubeを表す日本語の表記です。 名前について(英語)

目次

リファレンス

キューブのエンジンと表示

import { … } from "@johnmorrisdotca/kyuubu";

最小化と gzip 圧縮をしたサイズは 38.7 kB(読み込むものをすべて含み、esbuild で計測)

リファレンスの説明と例は英語です。見出しと目次は日本語です。

エクスポート

名前種類概要
algorithmName関数The name of one of the method's algorithms, as a person would say it: "Three corners round", 「コーナーの三点交換」.
applySolve関数A cube after these steps.
CliResult型What the command line came to: the exit code, and what goes to standard output and standard error.
CliSurroundings型What the command line is told about where it runs.
CliWords型The command line's words: its help, its refusals and what it reports.
Cloth型A cloth's name.
clothVars関数A cloth as CSS variables; nothing for a name that is not a cloth, so the defaults stay.
COMMIT_ANGLE定数The point of no return, in degrees, where none is given: let go short of it and the layer goes back.
countsAsMove関数Whether a move counts towards a solve's moves: a turn of the whole cube in the hand does not.
countSolveMoves関数How many of the steps count as moves: every turn, and no turn of the whole cube.
CUBE_FACE_ORDER定数The faces in the order a state is written: up, right, front, down, left, back.
CUBE_OPTION_GROUPS定数The order the groups are shown in, with what each is called.
CUBE_OPTIONS定数Every choice the package offers, grouped, with what each is called in each way of making a cube.
CUBE_OPTIONS_LEFT_OUT定数What is not a choice, by the way of making a cube that has it and its name there, each with why: a function, a value that is itself the state, a list that needs a program to write.
CUBE_SCALE_INTERACTIVE定数What a cube drawn at each scale is, apart from its width: a small one is for looking at, so it is not turned by a hand or a key unless asked.
CUBE_SCALE_PX定数How wide each is, in pixels: a cube is as tall as it is wide.
CUBE_SCALES定数HOW BIG A CUBE IS DRAWN, as a setting: small for a list or a picker, medium, and large.
CUBE_THEMES定数Looks that come with the package.
CubeAxis型An axis of the cube: 0 is x (to the right), 1 is y (up) and 2 is z (towards the viewer).
CubeFace型A face's letter: U, R, F, D, L or B.
CubeFaceLetter型A face as the notation names it.
CubeMaker型The three ways a cube is made.
CubeMove型One turn: a layer, or the whole cube, turned about an axis by one, two or three quarter turns.
cubeNet関数The cube unfolded flat, as lines of text: the top above the front, the left, front, right and back in a row, and the bottom below.
CubeOption型One choice.
CubeScale型One of the three.
cubeSlots関数Every sticker slot of a cube of this size, in the order its state is written, and the way back from a slot to its place.
cubeSolved関数SOLVED: every face one colour.
CubeTheme型How a cube looks: its six colours, its plastic, and the shape of a sticker.
CubeTurns型One, two or three quarter turns, counter-clockwise seen from the axis's positive end.
CubeViewクラスA cube on the screen.
CubeViewEvents型What a cube tells the listeners on adds: a turn a person made, with the stickers after it; and the view turned, in degrees.
CubeViewOptions型Everything a cube on the screen can be told when it is made.
cubeWidthPx関数The width in pixels a cube is drawn at: width when it is a number above zero, and otherwise the scale's.
CubeWords型THE WORDS THE CUBE ITSELF SAYS, in English and Japanese: what a screen reader calls it, whether it is solved, the names of the steps of a solve and what each is for, and the names of the method's algorithms.
decodeCubeMoves関数The moves written in a code, or null where any of it is not a move.
DEFAULT_COLOURS定数The standard colours, by the letter a solved face carries: white up, red right, green front, yellow down, orange left, blue back.
DEFAULT_PLASTIC定数The colour of the plastic between the stickers, where none is given.
DRAG_CLEAR_RATIO定数How much more one layer must go the pointer's way than the other to be picked before that.
DRAG_DECIDE_PX定数How far it goes before a drag that could be either of two layers picks the likelier anyway.
DRAG_START_PX定数How far the pointer goes, in pixels, before a drag picks a layer at all.
dragAngle関数The angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way.
dragHint関数The drag that makes this turn, from the way the cube is looked at now (view, as viewMatrix makes it).
DragHint型What to drag to make a turn of one layer, or of several about one axis as one (a wide turn).
DragPick型The layer a drag has picked: its axis and layer, and the way across the screen (a unit vector, x right and y down) that turns it forwards by the right-hand rule.
encodeCubeMoves関数Moves written three characters each, such as x23y02z*1: compact, and readable without knowing the cube's size.
FACE_FRAMES定数Which way each face looks, and its rows and columns as the face is seen from outside, in the order above.
FACE_PROPERTIES定数The CSS custom property that colours each face, where no colour is given in code: set it on the cube's element or any ancestor.
faceMove関数A face turned, depth layers in from it (1 is the face itself), on a cube of this size; null where the cube has no such layer.
faceOfNormal関数The face whose outward normal this is.
faceOfSlot関数The face letter a solved cube shows at this slot.
fill関数A line of a table with its braces filled in: fill("A {n}×{n} cube", { n: 3 }) is "A 3×3 cube".
FLICK_ANGLE定数The least a flick must have turned the layer, in degrees.
FLICK_SPEED定数A flick: the layer still turning this fast the drag's own way, in degrees a millisecond, when the pointer lets go.
fromJSON関数The solves in a JSON export, or null where the text is not one: not JSON, not this format, or a later one.
fromText関数A solve read back from plain lines, or null where they are not one.
FULL_SCRAMBLE_LENGTHS定数The lengths official competitions scramble each size to, near enough: what a "full" scramble means here.
GuideクラスA guide through a list of moves or the method's steps, for a cube of side n starting from state.
GUIDE_CSS定数The guide's stylesheet, put in the page once.
GuideHandle型A guide beside a cube, on the page.
GuideHeard型What a guide made of a turn it was told of: the movement finished, part of it made, a detour, or a detour taken back by hand.
GuidePanelOptions型How a guide beside a cube is set up: what it walks, and how it speaks.
GuideSource型What a guide walks: moves as written ("R U R' U'", wide turns and rotations read as parseSolve reads them), or as moves, each a movement; or the layer-by-layer method, step by step from the cube as it is (2×2 and 3×3).
GuideStep型The movement a guide asks for now.
HINT_MIN_FACING定数How squarely a face must face the viewer for an arrow to be drawn on it: the cosine of its angle to the eye.
HINT_MIN_FOLLOW定数How closely a drag along the arrow must go the way the layer turns: the cosine between them.
HintArrow型The arrow a hint draws, in the cube's doubled units (a sticker is 2 across), lying on a face.
isCloth関数Whether a text names a cloth.
isCubeScale関数Whether a value is one of the three scales.
isCubeState関数Whether a string is a state of a cube this size: the right length, and the right number of every colour.
joinTurns関数Turns of one layer in a row written as one, and any that come to nothing left out: "U' U2" is "U", "U' U" is nothing.
keepScrambling関数Keep a cube turning.
KeepScramblingHandle型What a running loop can be told.
KeepScramblingOptions型How it is run.
KeyReading型What a key means: a turn, a depth for the next face letter, or nothing.
KYUUBU_CLOTHS定数THE CLOTHS A PLAYER'S STAGE MAY BE LAID IN: the same five the whole family offers, and itsutsu.com's boards: green, blue, red, black and wood.
KyuubuLanguage型The two languages the package speaks.
KyuubuStrings型Every word the package says: the cube's and the command line's.
languageOf関数The language a tag names, as far as the package speaks it: anything beginning "ja" is Japanese, and the rest is English.
layerOf関数The layer, 0 to n − 1 from the axis's negative side, that a cubie centre sits in.
Mat3型A 3×3 matrix, rows of three.
MAX_CLI_COUNT定数The most scrambles the command line makes at once.
MAX_CLI_LENGTH定数The longest scramble the command line will make.
MAX_RECORD_MOVES定数The most turns one record may hold, scramble and solve each.
MAX_RECORD_SEED定数The longest seed kept with a solve.
MAX_RECORD_SIZE定数The largest cube a record may be of: the package is made and tested for 2×2 to 7×7.
MAX_RECORDS定数The most solves read from one file.
MAX_REPLAY_STEPS定数The longest solve a replay takes, in steps.
middleMove関数The middle layer of an odd cube, turned as M, E or S; null on an even cube, which has none.
MIN_RECORD_SIZE定数The smallest cube a record may be of.
mountGuide関数A guide drawn in an element, for the cube in view: the view shows the hint, and a person makes each movement on it.
mountMoveList関数A list of moves drawn in an element.
MOVE_LIST_CSS定数The list's stylesheet, put in the page once.
moveFits関数Whether a move can be made on a cube of this size.
moveForDrag関数The turn a drag across a sticker means: the layer that carries it most nearly the way the pointer went, that way.
moveForRelease関数The move a release makes: the picked layer turned by those quarters, or null for none.
moveForWheel関数The turn the wheel means over a sticker.
MoveListGroup型A run of moves under a heading: a scramble, a solution.
MoveListHandle型A list on the page.
MoveListItem型One move of a list: its code, what it turns in words (worked out from the code when left out), and the name a screen reader gives its button (the code and the words when left out).
MoveListOptions型How a list is set up.
movementSays関数A movement in plain words, for a cube held with its front towards you: "Turn the right face away from you.", 「右の面を奥に回します。」.
movementText関数A movement in notation: one layer as moveNotation writes it; several layers from a face inwards, about one axis and as far, as a wide turn (Rw, 3Rw'); anything else as its moves one after another.
moveName関数What a move turns, in a few plain words, in English or Japanese; null for anything that is not a move in standard form.
moveNotation関数A move as a person writes it, for a cube of this size.
movesForRelease関数Every layer a release turns: the picked layer, and the one beside it where the drag took a seam, each by those quarters; none for none.
movesNotation関数Moves as a person writes them, a space between each.
nextTurn関数One random layer, a quarter or a half turn either way, never about the axis the last one used, so it never undoes or joins it.
NotationFault型Why a line of notation could not be read, and where.
OptionGroup型What the choices are gathered under, in the order a page shows them.
OptionKind型How a choice is made: a number in a range, on or off, one of a few, a colour, or text (moves are text with notation in it).
paceSeconds関数Seconds for a pace given as a number or a name; the default for anything else.
parseMove関数One move read back from the notation, for a cube of this size, or null where it is not one: R, R', R2, 2R', M2, x'.
parseMoves関数A line of notation read back, or null where any of it is not a move on this cube.
parseSolve関数A solve, or a scramble, read from the way it is written, for a cube of this size.
parseSolveMove関数One written step read for a cube of this size, or why it is not one.
pastCommit関数Whether a dragged layer is past the point of no return: letting go now, at rest, makes a move.
permutationOf関数Where every sticker goes under one turn: to[i] is the slot the sticker in slot i lands on.
pickDrag関数The layer a drag across a sticker means, once it can be told: null while the pointer has not gone far enough, or while the two layers that carry the sticker are too nearly as likely as each other.
planReplay関数A scramble and a solve read, checked and timed.
prefersReducedMotion関数Whether this device asks for less motion.
quartersForRelease関数What letting go makes of a dragged layer: the quarter turns it snaps to, from −2 to 2, where 0 is back where it was and no move at all.
quarterTurn関数A quarter turn counter-clockwise, seen from the axis's positive end.
randomScramble関数A scramble of length turns, each of one layer chosen at random, never two in a row about the same axis, so no turn undoes or joins the one before it and the count is the count.
readKey関数What a key means on a cube of side n, given the depth a digit before it set (1 where none did).
readSolveLink関数A solve read out of a link to alg.cubing.net, the page most reconstructions are shared by, so that a person can paste the address and not copy two boxes by hand.
RECORD_FORMAT定数The version of the JSON's shape.
ReplayクラスA planned solve played on a cube: play, pause, a step either way, anywhere by seek, faster or slower, once or over and over.
REPLAY_LOOP_REST_MS定数How long a looped replay rests on the solved cube before it begins again, in milliseconds.
REPLAY_SCRAMBLE_STEP_MS定数How long each turn of the scramble takes when the replay walks through it, in milliseconds.
REPLAY_SCRUB_MS定数How long each turn made by moving the slider takes, in milliseconds.
REPLAY_SCRUB_TURNS定数How many turns moving the slider shows one by one: a longer jump goes straight to this many steps short of where it is going, and turns the rest.
REPLAY_SPEEDS定数The speeds a replay offers: the solve's own pace, half, a quarter and a tenth of it.
REPLAY_STEP_MS定数How long a step takes when the solve gives no time of its own, in milliseconds.
ReplayClock型The clock a replay runs by; the page's own unless a test gives another.
ReplayCube型The part of a cube's view a replay needs: CubeView is one.
ReplayFault型Why a replay could not be planned: which text would not read, and where.
ReplayOptions型How a replay is set up.
ReplayPlan型A solve ready to be played: read, checked and timed.
ReplaySource型What a replay is made from.
ReplayStatus型What a replay tells whoever is showing it.
rotationHint関数WHICH WAY TO TURN THE WHOLE CUBE: no drag on a sticker makes it (a key or a button does: x, y, z), so there is no sticker to take hold of, but the way it goes can still be drawn.
rotationKeys関数The key or keys that make a turn of the whole cube: X, Shift+X, X X.
runCli関数The whole command line.
SCRAMBLE_DEFAULT_PACE定数The pace when none is given: one turn a second.
SCRAMBLE_PACES定数How often it turns, in seconds, by name.
SCRAMBLE_SHORTEST定数The shortest wait it allows, in seconds: faster is a blur, and a page that asks for it gets this.
Scrambled型What the loop turns: the cube on the screen has all of it.
ScrambleOptions型How a scramble is made.
ScramblePace型One of those names.
ScramblePage型The part of a page the loop listens to: a Document is one.
scrubPath関数What moving the slider from one position of a solve to another turns: the steps between, forwards when going on and each one undone, last first, when going back.
ScrubPath型The turns that take a cube from one position of a solve to another, for a slider that turns the cube as it moves.
Seam型A seam a hand has taken hold of: a turn about this axis would carry the layer the sticker is in and the one beside it, together.
SEAM_BAND定数How near a seam between two layers a touch lands to take both: this share of a sticker's width on each side of the line between them, so that the middle of a sticker, and a little more than half of its width, is still the one layer.
seamsAt関数The seams a touch at this place on a sticker is taking hold of, nearest first: where it lands within SEAM_BAND of a sticker's width of the line that parts the sticker's layer from the one beside it, along either of the two directions the sticker can be turned across.
seededRandom関数A SEEDED RANDOM SOURCE: the same seed gives the same numbers, in the same order, on every device and in every version from 1.1.0 on.
SOLVABLE_SIZES定数The sizes the method is written for.
SOLVE_ALGORITHMS定数The algorithms the method uses, by name.
SolveAlgorithm型The name of one of the method's algorithms: a key of SOLVE_ALGORITHMS.
solvedCube関数A solved cube of this size.
SolveLink型A solve as a link carries it: its scramble, its moves, and its title where it has one.
SolveMove型One thing a solver did: a turn, a wide turn or a turn of the whole cube.
solveMoves関数Every layer a list of steps turns, in order: what turnAll takes.
SolvePart型A part of a step: turns to line something up, or one of the method's algorithms.
SolveReading型What reading a solve gives: its steps, or the first thing that could not be read.
SolveRecord型One solve: the cube's size, the scramble that mixed it, and the turns made after.
SolveStage型The stages of the method, in the order they are done.
SolveStep型One step of a solve: its stage, the turns that do it, and the parts they come in.
solveSteps関数The layer-by-layer solve of a 2×2 or 3×3 in this state, as steps a person can follow, or null for a size the method is not written for.
SolveSummary型What a record comes to, worked out from its turns.
solveText関数The steps written out in standard form, a space between each.
stageName関数The name of a step of the solve, as a person would say it: "White cross", 「白のクロス」.
stageSays関数What a step of the solve is for, in a sentence: "Make a yellow cross on the top."
StickerSlot型Where one sticker slot sits: its cubie's centre and the direction it faces.
STRINGS定数The package's words in both languages.
summarize関数A record's scramble and turns in notation, the cube before and after, whether it ended solved, and its count of moves.
toCSV関数A list of solves as CSV, for a spreadsheet: a header, then a row a solve, with lines ended CRLF as RFC 4180 has them.
toJSON関数One solve or many, as JSON: { "format": 1, "generator": "kyuubu 1.1.0", "solves": [ … ] }.
toText関数A solve as a few plain lines, to paste in a chat or a note:
turnAll関数The state after every turn in order.
turnCube関数The state after one turn.
undoAll関数A list of moves undone, last first.
undoOf関数The move that takes this one back.
Vec3型A point in the cube's doubled coordinates: a cubie's centre is a whole even or odd step from the middle, by the cube's size.
VERSION定数The package's version, as in package.json.
viewMatrix関数The way the viewer looks at the cube: turned about the model's y (yaw), then tipped about the screen's x (pitch), in degrees.
wholeMove関数The whole cube turned in the hand, as x, y or z.
WORDS定数The cube's words in both languages.

ソースを見るGitHub で編集@johnmorrisdotca/kyuubu 1.14.1 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。