arcanumcube 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.html CHANGED
@@ -46,9 +46,14 @@
46
46
  const light = new THREE.AmbientLight('#fff', 1.0);
47
47
  scene.add(light);
48
48
 
49
+ // sun light
50
+ const sunLight = new THREE.DirectionalLight('#fff', 1.0);
51
+ sunLight.position.set(-16, 80, 48);
52
+ scene.add(sunLight);
53
+
49
54
  // spot light
50
- const spotLight = new THREE.SpotLight('#fff', 2.0, 20, Math.PI / 4, 0.6, 0.01);
51
- spotLight.position.set(4, 8, 4);
55
+ const spotLight = new THREE.SpotLight('#fff', 4, 64, Math.PI / 6, 0.8, 0.01);
56
+ spotLight.position.set(12, 12, 6);
52
57
  spotLight.target.position.set(0, 0, 0);
53
58
  scene.add(spotLight);
54
59
 
@@ -60,11 +65,6 @@
60
65
  scene.add(arccubeGroup);
61
66
 
62
67
  renderer.setAnimationLoop((time) => {
63
- /* rotate cube
64
- arccubeGroup.rotation.x -= 0.005;
65
- arccubeGroup.rotation.y += 0.005;
66
- */
67
-
68
68
  // animate twisting
69
69
  arccube.updateTweens();
70
70
 
@@ -64,10 +64,12 @@ export declare const TWIST_RULE: Record<Twist, {
64
64
  export declare function getStickerIndex(x: number, y: number, z: number, face: Face): number;
65
65
  export declare function getCubeFromStickerIndex(index: number): [x: number, y: number, z: number, face: Face];
66
66
  export declare function getRandomTwistList(steps?: number): Twist[];
67
+ export declare function MatchGoalState(state: StickerColor[]): boolean;
67
68
  export type Sticker = {
68
69
  face: Face;
69
70
  color: StickerColor;
70
71
  };
72
+ /** One small cube class that makes up the Arcanum Cube */
71
73
  export declare class Cube {
72
74
  type: string;
73
75
  position: {
@@ -102,6 +104,7 @@ export declare class ArcanumCube {
102
104
  reset(): void;
103
105
  scramble(steps?: number): void;
104
106
  undo(steps?: number): void;
107
+ isSolved(): boolean;
105
108
  getHistory(): Twist[];
106
109
  getUndoList(steps?: number): Twist[];
107
110
  twist(twist: Twist | Twist[], reverse?: boolean): void;
@@ -3,6 +3,11 @@ import { Cube, ArcanumCube } from './core.js';
3
3
  import type { Twist, Sticker } from './core.js';
4
4
  import { type Skin } from './skins.js';
5
5
  export declare const CUBE_SIDE_LEN = 1.9;
6
+ export type TwistOptions = {
7
+ onStart?: (self: WebGLArcanumCube) => void;
8
+ onTwisted?: (self: WebGLArcanumCube, twist: Twist, step: number, total: number) => void;
9
+ onComplete?: (self: WebGLArcanumCube) => void;
10
+ };
6
11
  type WebGLSticker = Sticker & {
7
12
  mesh?: THREE.Mesh;
8
13
  };
@@ -14,6 +19,7 @@ export type WebGLCubeConfig = {
14
19
  skin: Skin;
15
20
  envMap?: THREE.Texture;
16
21
  wireframe: boolean;
22
+ wireframeColor: THREE.ColorRepresentation;
17
23
  };
18
24
  declare class WebGLCube extends Cube {
19
25
  protected _stickers: WebGLSticker[];
@@ -46,8 +52,13 @@ export type WebGLArcanumCubeConfig = {
46
52
  envMap?: THREE.Texture;
47
53
  showSelectedCube: boolean;
48
54
  showTwistGroup: boolean;
49
- enableLight: boolean;
55
+ autoReset: boolean;
56
+ enableCoreLight: boolean;
57
+ coreLightColor: THREE.ColorRepresentation;
58
+ coreLightIntensity: number;
50
59
  wireframe: boolean;
60
+ wireframeColor: THREE.ColorRepresentation;
61
+ twistOptions?: TwistOptions;
51
62
  };
52
63
  /** Arcanum Cube object for WebGL class */
53
64
  declare class WebGLArcanumCube extends ArcanumCube {
@@ -74,7 +85,7 @@ declare class WebGLArcanumCube extends ArcanumCube {
74
85
  /** tween group */
75
86
  private _tweens;
76
87
  /** light at the center of cube */
77
- private _pointLights;
88
+ private _coreLights;
78
89
  constructor(options?: Partial<WebGLArcanumCubeConfig>);
79
90
  getGroup(): THREE.Group;
80
91
  getCubeObjectList(): THREE.Group[];
@@ -99,10 +110,12 @@ declare class WebGLArcanumCube extends ArcanumCube {
99
110
  dragTwistEnd(): void;
100
111
  scramble(steps?: number, duration?: number): void;
101
112
  undo(steps?: number, duration?: number): void;
102
- tweenTwist(twist: Twist | Twist[], reverse?: boolean, duration?: number, cancel?: boolean): void;
113
+ tweenTwist(twist: Twist | Twist[], reverse?: boolean, duration?: number, cancel?: boolean, options?: TwistOptions): void;
103
114
  private _immediatelyTwist;
104
115
  private _tweenTwist;
105
116
  updateTweens(): void;
117
+ setCoreLightColor(color: THREE.ColorRepresentation): void;
118
+ setCoreLightIntensity(intensity: number): void;
106
119
  }
107
120
  export * from './core.js';
108
121
  export { WebGLArcanumCube };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arcanumcube",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Arcanum Cube",
5
5
  "type": "module",
6
6
  "license": "MIT",