Skip to the content

Kyuubuキューブ

Turn CSS 3D cubes by touch, keys or notation, reproduce a scramble from a seed, and follow a solve one named step at a time.

Kyuubu (キューブ) is the Japanese spelling of cube. About the name

Contents

Reference · Cube engine and views

Mat3type

A 3×3 matrix, rows of three.

Import it

import type { Mat3 } from "@johnmorrisdotca/kyuubu";

Definition

type Mat3 = readonly [
    Vec3,
    Vec3,
    Vec3
];

Members

NameTypeDescription
0Vec3
1Vec3
2Vec3
length3
toString(): string

Returns a string representation of an array.

toLocaleString(): string (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string

Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.

concat(...items: ConcatArray<Vec3>[]): Vec3[] (...items: (Vec3 | ConcatArray<Vec3>)[]): Vec3[]

Combines two or more arrays.

join(separator?: string): string

Adds all the elements of an array separated by the specified separator string.

slice(start?: number, end?: number): Vec3[]

Returns a section of an array.

indexOf(searchElement: Vec3, fromIndex?: number): number

Returns the index of the first occurrence of a value in an array.

lastIndexOf(searchElement: Vec3, fromIndex?: number): number

Returns the index of the last occurrence of a specified value in an array.

every<S extends Vec3>(predicate: (value: Vec3, index: number, array: readonly Vec3[]) => value is S, thisArg?: any): this is readonly S[] (predicate: (value: Vec3, index: number, array: readonly Vec3[]) => unknown, thisArg?: any): boolean

Determines whether all the members of an array satisfy the specified test.

some(predicate: (value: Vec3, index: number, array: readonly Vec3[]) => unknown, thisArg?: any): boolean

Determines whether the specified callback function returns true for any element of an array.

forEach(callbackfn: (value: Vec3, index: number, array: readonly Vec3[]) => void, thisArg?: any): void

Performs the specified action for each element in an array.

map<U>(callbackfn: (value: Vec3, index: number, array: readonly Vec3[]) => U, thisArg?: any): U[]

Calls a defined callback function on each element of an array, and returns an array that contains the results.

filter<S extends Vec3>(predicate: (value: Vec3, index: number, array: readonly Vec3[]) => value is S, thisArg?: any): S[] (predicate: (value: Vec3, index: number, array: readonly Vec3[]) => unknown, thisArg?: any): Vec3[]

Returns the elements of an array that meet the condition specified in a callback function.

reduce(callbackfn: (previousValue: Vec3, currentValue: Vec3, currentIndex: number, array: readonly Vec3[]) => Vec3): Vec3 (callbackfn: (previousValue: Vec3, currentValue: Vec3, currentIndex: number, array: readonly Vec3[]) => Vec3, initialValue: Vec3): Vec3 <U>(callbackfn: (previousValue: U, currentValue: Vec3, currentIndex: number, array: readonly Vec3[]) => U, initialValue: U): U

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

reduceRight(callbackfn: (previousValue: Vec3, currentValue: Vec3, currentIndex: number, array: readonly Vec3[]) => Vec3): Vec3 (callbackfn: (previousValue: Vec3, currentValue: Vec3, currentIndex: number, array: readonly Vec3[]) => Vec3, initialValue: Vec3): Vec3 <U>(callbackfn: (previousValue: U, currentValue: Vec3, currentIndex: number, array: readonly Vec3[]) => U, initialValue: U): U

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

find<S extends Vec3>(predicate: (value: Vec3, index: number, obj: readonly Vec3[]) => value is S, thisArg?: any): S | undefined (predicate: (value: Vec3, index: number, obj: readonly Vec3[]) => unknown, thisArg?: any): Vec3 | undefined

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

findIndex(predicate: (value: Vec3, index: number, obj: readonly Vec3[]) => unknown, thisArg?: any): number

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

entries(): ArrayIterator<[number, Vec3]>

Returns an iterable of key, value pairs for every entry in the array

keys(): ArrayIterator<number>

Returns an iterable of keys in the array

values(): ArrayIterator<Vec3>

Returns an iterable of values in the array

includes(searchElement: Vec3, fromIndex?: number): boolean

Determines whether an array includes a certain element, returning true or false as appropriate.

flatMap<U, This = undefined>(callback: (this: This, value: Vec3, index: number, array: Vec3[]) => U | readonly U[], thisArg?: This | undefined): U[]

Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1.

flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[]

Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth.

at(index: number): Vec3 | undefined

Returns the item located at the specified index.

Examples

import type { Mat3 } from "@johnmorrisdotca/kyuubu";
import { viewMatrix } from "@johnmorrisdotca/kyuubu";

const value: Mat3 = viewMatrix(-30, -20);
console.log(value);
[
  [ 0.8660254037844387, 0, -0.49999999999999994 ],
  [ 0.17101007166283433, 0.9396926207859084, 0.29619813272602386 ],
  [ 0.46984631039295416, -0.3420201433256687, 0.8137976813493738 ]
]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kyuubu 1.14.1.