Reference · Cube engine and views
keepScramblingfunction
Keep a cube turning. Starts at once unless autoplay is false.
Import it
import { keepScrambling } from "@johnmorrisdotca/kyuubu";
Definition
function keepScrambling(cube: Scrambled, options?: KeepScramblingOptions): KeepScramblingHandle
Parameters
| Name | Type | Description |
|---|---|---|
cube | Scrambled | The cube whose state or turning is controlled. |
options (optional) | KeepScramblingOptions | Options for this call; omitted fields retain their documented defaults. |
Returns
KeepScramblingHandle
Keep a cube turning. Starts at once unless autoplay is false.
Examples
import { CubeView, keepScrambling } from "@johnmorrisdotca/kyuubu";
const host = document.createElement("div");
host.style.cssText = "width:160px;height:160px;position:relative";
document.body.append(host);
const cube = new CubeView(host, { size: 3 });
const turning = keepScrambling(cube, { autoplay: false, pace: "slow" });
console.log(turning.running);
// turning.start() begins; turning.destroy() and cube.destroy() clean up.