本文へ移動

Kyuubuキューブ

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

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

目次

リファレンス · 直方体のエンジン

cuboidDragAngle関数

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

The angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way. A layer that only half turns follows twice as fast, so that the whole half turn is as far a drag as a quarter of any other. quarterPx is the pixels that make a quarter turn.

インポート

import { cuboidDragAngle } from "@johnmorrisdotca/kyuubu/cuboid";

定義

function cuboidDragAngle(pick: CuboidDragPick, dx: number, dy: number, quarterPx: number): number

引数

名前型説明
pickCuboidDragPick

The layer and screen direction selected by a drag.

dxnumber

The horizontal pointer displacement in pixels.

dynumber

The vertical pointer displacement in pixels.

quarterPxnumber

The pointer distance in pixels that makes a quarter turn.

戻り値

number

The angle, in degrees, a picked layer has been dragged to: forwards is positive, and it stops at a half turn either way. A layer that only half turns follows twice as fast, so that the whole half turn is as far a drag as a quarter of any other. quarterPx is the pixels that make a quarter turn.

例

import { cuboidDragAngle } from "@johnmorrisdotca/kyuubu/cuboid";

const cpick = { axis: 1 as const, layer: 0, along: [1, 0] as [number, number], halfOnly: true };
console.log(cuboidDragAngle(cpick, 40, 0, 100));
72

出力(このページを作ったときに実行した結果)

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

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