@wise/art 2.7.0 → 2.8.0
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/README.md +47 -0
- package/dist/CheckMark-6516e382.js +39 -0
- package/dist/CheckMark-6516e382.js.map +1 -0
- package/dist/CheckMark-7e2e6863.esm.js +37 -0
- package/dist/CheckMark-7e2e6863.esm.js.map +1 -0
- package/dist/Confetti-71f18588.js +36 -0
- package/dist/Confetti-71f18588.js.map +1 -0
- package/dist/Confetti-f1f0c4a5.esm.js +34 -0
- package/dist/Confetti-f1f0c4a5.esm.js.map +1 -0
- package/dist/Flower-2325e8ba.js +29 -0
- package/dist/Flower-2325e8ba.js.map +1 -0
- package/dist/Flower-8a17d7a6.esm.js +27 -0
- package/dist/Flower-8a17d7a6.esm.js.map +1 -0
- package/dist/Globe-601b1eb5.esm.js +43 -0
- package/dist/Globe-601b1eb5.esm.js.map +1 -0
- package/dist/Globe-93237bd2.js +45 -0
- package/dist/Globe-93237bd2.js.map +1 -0
- package/dist/Graph-536a6847.js +33 -0
- package/dist/Graph-536a6847.js.map +1 -0
- package/dist/Graph-e766a791.esm.js +31 -0
- package/dist/Graph-e766a791.esm.js.map +1 -0
- package/dist/Illustration.css +19 -0
- package/dist/Jars-9afb6e8b.esm.js +50 -0
- package/dist/Jars-9afb6e8b.esm.js.map +1 -0
- package/dist/Jars-fcb1e2b1.js +52 -0
- package/dist/Jars-fcb1e2b1.js.map +1 -0
- package/dist/Lock-2365c3f9.esm.js +41 -0
- package/dist/Lock-2365c3f9.esm.js.map +1 -0
- package/dist/Lock-e5c89aa2.js +43 -0
- package/dist/Lock-e5c89aa2.js.map +1 -0
- package/dist/MagnifyingGlass-92351fd6.js +32 -0
- package/dist/MagnifyingGlass-92351fd6.js.map +1 -0
- package/dist/MagnifyingGlass-92fbedda.esm.js +30 -0
- package/dist/MagnifyingGlass-92fbedda.esm.js.map +1 -0
- package/dist/Marble-0f2d6f38.js +44 -0
- package/dist/Marble-0f2d6f38.js.map +1 -0
- package/dist/Marble-91d300a3.esm.js +42 -0
- package/dist/Marble-91d300a3.esm.js.map +1 -0
- package/dist/MarbleCard-690b2b8e.esm.js +45 -0
- package/dist/MarbleCard-690b2b8e.esm.js.map +1 -0
- package/dist/MarbleCard-ed7536dc.js +47 -0
- package/dist/MarbleCard-ed7536dc.js.map +1 -0
- package/dist/MultiCurrency-0456db19.js +63 -0
- package/dist/MultiCurrency-0456db19.js.map +1 -0
- package/dist/MultiCurrency-1b491db5.esm.js +61 -0
- package/dist/MultiCurrency-1b491db5.esm.js.map +1 -0
- package/dist/Plane-b6340ff4.js +39 -0
- package/dist/Plane-b6340ff4.js.map +1 -0
- package/dist/Plane-d631e81c.esm.js +37 -0
- package/dist/Plane-d631e81c.esm.js.map +1 -0
- package/dist/Scene-45fbe252.js +48 -0
- package/dist/Scene-45fbe252.js.map +1 -0
- package/dist/Scene-783029f4.esm.js +46 -0
- package/dist/Scene-783029f4.esm.js.map +1 -0
- package/dist/common.d.ts +5 -0
- package/dist/common.d.ts.map +1 -1
- package/dist/illustrations3d/Illustration3D.d.ts +11 -0
- package/dist/illustrations3d/Illustration3D.d.ts.map +1 -0
- package/dist/illustrations3d/Scene.d.ts +10 -0
- package/dist/illustrations3d/Scene.d.ts.map +1 -0
- package/dist/illustrations3d/index.d.ts +5 -0
- package/dist/illustrations3d/index.d.ts.map +1 -0
- package/dist/illustrations3d/models/CheckMark.d.ts +4 -0
- package/dist/illustrations3d/models/CheckMark.d.ts.map +1 -0
- package/dist/illustrations3d/models/Confetti.d.ts +4 -0
- package/dist/illustrations3d/models/Confetti.d.ts.map +1 -0
- package/dist/illustrations3d/models/Flower.d.ts +4 -0
- package/dist/illustrations3d/models/Flower.d.ts.map +1 -0
- package/dist/illustrations3d/models/Globe.d.ts +4 -0
- package/dist/illustrations3d/models/Globe.d.ts.map +1 -0
- package/dist/illustrations3d/models/Graph.d.ts +4 -0
- package/dist/illustrations3d/models/Graph.d.ts.map +1 -0
- package/dist/illustrations3d/models/Jars.d.ts +4 -0
- package/dist/illustrations3d/models/Jars.d.ts.map +1 -0
- package/dist/illustrations3d/models/Lock.d.ts +4 -0
- package/dist/illustrations3d/models/Lock.d.ts.map +1 -0
- package/dist/illustrations3d/models/MagnifyingGlass.d.ts +4 -0
- package/dist/illustrations3d/models/MagnifyingGlass.d.ts.map +1 -0
- package/dist/illustrations3d/models/Marble.d.ts +4 -0
- package/dist/illustrations3d/models/Marble.d.ts.map +1 -0
- package/dist/illustrations3d/models/MarbleCard.d.ts +4 -0
- package/dist/illustrations3d/models/MarbleCard.d.ts.map +1 -0
- package/dist/illustrations3d/models/MultiCurrency.d.ts +4 -0
- package/dist/illustrations3d/models/MultiCurrency.d.ts.map +1 -0
- package/dist/illustrations3d/models/Plane.d.ts +4 -0
- package/dist/illustrations3d/models/Plane.d.ts.map +1 -0
- package/dist/illustrations3d/utils.d.ts +9 -0
- package/dist/illustrations3d/utils.d.ts.map +1 -0
- package/dist/index-3b6277fc.esm.js +325 -0
- package/dist/index-3b6277fc.esm.js.map +1 -0
- package/dist/index-c17944c0.js +332 -0
- package/dist/index-c17944c0.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +4 -158
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +15 -155
- package/dist/index.js.map +1 -1
- package/package.json +10 -4
- package/src/common.ts +6 -0
- package/src/illustrations/Illustration.css +19 -0
- package/src/illustrations3d/Illustration3D.stories.tsx +88 -0
- package/src/illustrations3d/Illustration3D.tsx +133 -0
- package/src/illustrations3d/Scene.tsx +54 -0
- package/src/illustrations3d/index.ts +6 -0
- package/src/illustrations3d/models/CheckMark.tsx +30 -0
- package/src/illustrations3d/models/Confetti.tsx +29 -0
- package/src/illustrations3d/models/Flower.tsx +24 -0
- package/src/illustrations3d/models/Globe.tsx +41 -0
- package/src/illustrations3d/models/Graph.tsx +26 -0
- package/src/illustrations3d/models/Jars.tsx +47 -0
- package/src/illustrations3d/models/Lock.tsx +38 -0
- package/src/illustrations3d/models/MagnifyingGlass.tsx +30 -0
- package/src/illustrations3d/models/Marble.tsx +47 -0
- package/src/illustrations3d/models/MarbleCard.tsx +50 -0
- package/src/illustrations3d/models/MultiCurrency.tsx +58 -0
- package/src/illustrations3d/models/Plane.tsx +33 -0
- package/src/illustrations3d/utils.ts +68 -0
- package/src/index.ts +5 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useGLTF } from '@react-three/drei';
|
|
2
|
+
import { useFrame, useLoader } from '@react-three/fiber';
|
|
3
|
+
import { TextureLoader, ObjectLoader } from 'three';
|
|
4
|
+
|
|
5
|
+
import { defineSrc } from '../utils';
|
|
6
|
+
|
|
7
|
+
const Globe = () => {
|
|
8
|
+
const { scene } = useGLTF(defineSrc('globe.gltf'));
|
|
9
|
+
|
|
10
|
+
const lights = useLoader(ObjectLoader, defineSrc('globe-light.json'));
|
|
11
|
+
const wiseLogo = useLoader(TextureLoader, defineSrc('wise-flag-map-bump.jpg'));
|
|
12
|
+
const planet = scene.getObjectByName('Globe');
|
|
13
|
+
const orbit = scene.getObjectByName('Coins_Axis_Rotation_Animate');
|
|
14
|
+
|
|
15
|
+
scene.traverse((child) => {
|
|
16
|
+
if (child.name.startsWith('Coin_')) {
|
|
17
|
+
const mesh = child;
|
|
18
|
+
|
|
19
|
+
const material = mesh.material;
|
|
20
|
+
material.bumpMap = wiseLogo;
|
|
21
|
+
material.bumpMap.flipY = false;
|
|
22
|
+
mesh.castShadow = false;
|
|
23
|
+
mesh.receiveShadow = false;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
useFrame(() => {
|
|
28
|
+
orbit.rotation.y += 0.002;
|
|
29
|
+
|
|
30
|
+
planet.material.map.offset.x += -0.0002;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<>
|
|
35
|
+
<primitive position={[0, -10, 0]} scale={1.3} object={scene} />
|
|
36
|
+
<primitive object={lights} />
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export default Globe;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useGLTF } from '@react-three/drei';
|
|
2
|
+
import { useFrame, useLoader } from '@react-three/fiber';
|
|
3
|
+
import { ObjectLoader } from 'three';
|
|
4
|
+
|
|
5
|
+
import { defineSrc } from '../utils';
|
|
6
|
+
|
|
7
|
+
const Graph = () => {
|
|
8
|
+
const model = useGLTF(defineSrc(`graph.gltf`));
|
|
9
|
+
|
|
10
|
+
const lights = useLoader(ObjectLoader, defineSrc('graph-light.json'));
|
|
11
|
+
|
|
12
|
+
useFrame(() => {
|
|
13
|
+
const { offset } = model.materials['Standard '].map;
|
|
14
|
+
offset.x += -0.0015;
|
|
15
|
+
offset.y += 0.0015;
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<>
|
|
20
|
+
<primitive scale={1.3} position={[0, -10, 0]} object={model.scene} />
|
|
21
|
+
<primitive object={lights} />
|
|
22
|
+
</>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default Graph;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useGLTF, useAnimations } from '@react-three/drei';
|
|
2
|
+
import { useFrame, useLoader } from '@react-three/fiber';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { TextureLoader, ObjectLoader } from 'three';
|
|
5
|
+
|
|
6
|
+
import { defineSrc } from '../utils';
|
|
7
|
+
|
|
8
|
+
const Jars = () => {
|
|
9
|
+
const ref = useRef();
|
|
10
|
+
const model = useGLTF(defineSrc('jars.gltf'));
|
|
11
|
+
const lights = useLoader(ObjectLoader, defineSrc('jars-light.json'));
|
|
12
|
+
const wiseLogo = useLoader(TextureLoader, defineSrc('wise-flag-map-bump.jpg'));
|
|
13
|
+
const jars = [];
|
|
14
|
+
|
|
15
|
+
model.scene.traverse((child) => {
|
|
16
|
+
if (child.name.startsWith('Coin_')) {
|
|
17
|
+
child.material.bumpMap = wiseLogo;
|
|
18
|
+
|
|
19
|
+
child.material.bumpMap.flipY = false;
|
|
20
|
+
child.castShadow = false;
|
|
21
|
+
child.receiveShadow = false;
|
|
22
|
+
}
|
|
23
|
+
if (child.name.startsWith('Jar_')) {
|
|
24
|
+
jars.push(child);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const { mixer, clips } = useAnimations(model.animations, ref);
|
|
29
|
+
|
|
30
|
+
useFrame(() => {
|
|
31
|
+
mixer.clipAction(clips[0]).play();
|
|
32
|
+
|
|
33
|
+
jars.forEach((jar) => {
|
|
34
|
+
jar.material.map.offset.x += 0.001;
|
|
35
|
+
jar.material.map.offset.y += 0.0;
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
<primitive ref={ref} scale={1.3} position={[0, -10, 0]} object={model.scene} />
|
|
42
|
+
<primitive object={lights} />
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default Jars;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useGLTF, useAnimations } from '@react-three/drei';
|
|
2
|
+
import { useFrame, useLoader } from '@react-three/fiber';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { LoopOnce, ObjectLoader } from 'three';
|
|
5
|
+
|
|
6
|
+
import { defineSrc } from '../utils';
|
|
7
|
+
|
|
8
|
+
const Lock = () => {
|
|
9
|
+
const ref = useRef();
|
|
10
|
+
const model = useGLTF(defineSrc('lock.gltf'));
|
|
11
|
+
|
|
12
|
+
const lights = useLoader(ObjectLoader, defineSrc('lock-light.json'));
|
|
13
|
+
|
|
14
|
+
model.scene.traverse((node) => {
|
|
15
|
+
if (node.isMesh) {
|
|
16
|
+
node.castShadow = true;
|
|
17
|
+
node.receiveShadow = true;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const { clips, mixer } = useAnimations(model.animations, ref);
|
|
22
|
+
let frame = 0;
|
|
23
|
+
useFrame(() => {
|
|
24
|
+
mixer.clipAction(clips[0]).play().setLoop(LoopOnce, 1);
|
|
25
|
+
model.scene.position.y = Math.sin(frame++ * 0.04) * 0.2;
|
|
26
|
+
|
|
27
|
+
model.materials.Standard.map.offset.x += -0.001;
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<primitive ref={ref} scale={1.4} object={model.scene} />
|
|
33
|
+
<primitive object={lights} />
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default Lock;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useGLTF } from '@react-three/drei';
|
|
2
|
+
import { useFrame, useLoader } from '@react-three/fiber';
|
|
3
|
+
import { ObjectLoader } from 'three';
|
|
4
|
+
|
|
5
|
+
import { defineSrc } from '../utils';
|
|
6
|
+
|
|
7
|
+
const MagnifyingGlass = () => {
|
|
8
|
+
const model = useGLTF(defineSrc(`magnifying-glass.gltf`));
|
|
9
|
+
|
|
10
|
+
const lights = useLoader(ObjectLoader, defineSrc('magnifying-glass-light.json'));
|
|
11
|
+
|
|
12
|
+
const lens = model.scene.getObjectByName('Optimised_lens');
|
|
13
|
+
|
|
14
|
+
useFrame(() => {
|
|
15
|
+
lens.material.transparent = true;
|
|
16
|
+
|
|
17
|
+
lens.material.opacity = 0.8;
|
|
18
|
+
|
|
19
|
+
model.materials['Tapestry WebGL'].map.offset.x += -0.0006;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<>
|
|
24
|
+
<primitive scale={1.5} position={[0, -12, 0]} object={model.scene} />
|
|
25
|
+
<primitive object={lights} />
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default MagnifyingGlass;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { useGLTF } from '@react-three/drei';
|
|
2
|
+
import { useFrame, useLoader } from '@react-three/fiber';
|
|
3
|
+
import { ObjectLoader } from 'three';
|
|
4
|
+
|
|
5
|
+
import { defineSrc } from '../utils';
|
|
6
|
+
|
|
7
|
+
const Marble = () => {
|
|
8
|
+
const model = useGLTF(defineSrc('marble.gltf'));
|
|
9
|
+
|
|
10
|
+
const lights = useLoader(ObjectLoader, defineSrc('marble-light.json'));
|
|
11
|
+
|
|
12
|
+
const sphere = model.scene.getObjectByName('Sphere1');
|
|
13
|
+
sphere.material.depthTest = true;
|
|
14
|
+
|
|
15
|
+
const stripeBottom = model.scene.getObjectByName('Strip_Center_Big_(4th_-_Bottom_Layer)');
|
|
16
|
+
stripeBottom.material.depthTest = false;
|
|
17
|
+
stripeBottom.renderOrder = 1;
|
|
18
|
+
|
|
19
|
+
const stripeLeft = model.scene.getObjectByName('Strip_Left_(3rd)');
|
|
20
|
+
stripeLeft.material.depthTest = false;
|
|
21
|
+
stripeLeft.renderOrder = 2;
|
|
22
|
+
|
|
23
|
+
const stripeRight = model.scene.getObjectByName('Strip_Left_(3rd)');
|
|
24
|
+
stripeRight.material.depthTest = false;
|
|
25
|
+
stripeRight.renderOrder = 3;
|
|
26
|
+
|
|
27
|
+
const stripeTop = model.scene.getObjectByName('Strip_Center_(1st_-_Top_Layer)');
|
|
28
|
+
stripeTop.material.depthTest = false;
|
|
29
|
+
stripeTop.renderOrder = 4;
|
|
30
|
+
|
|
31
|
+
const animatedMaps = [sphere, stripeTop, stripeBottom, stripeLeft, stripeRight].map(
|
|
32
|
+
(object) => object.material.map,
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
useFrame(() => {
|
|
36
|
+
animatedMaps.forEach((map) => (map.offset.y += -0.0015));
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<>
|
|
41
|
+
<primitive scale={1.4} position={[0, -11, 0]} object={model.scene} />
|
|
42
|
+
<primitive object={lights} />
|
|
43
|
+
</>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default Marble;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useGLTF } from '@react-three/drei';
|
|
2
|
+
import { useFrame, useLoader } from '@react-three/fiber';
|
|
3
|
+
import { ObjectLoader } from 'three';
|
|
4
|
+
|
|
5
|
+
import { defineSrc } from '../utils';
|
|
6
|
+
|
|
7
|
+
const MarbleCard = () => {
|
|
8
|
+
const model = useGLTF(defineSrc('marble-card.gltf'));
|
|
9
|
+
|
|
10
|
+
const lights = useLoader(ObjectLoader, defineSrc('marble-card-light.json'));
|
|
11
|
+
const sphere = model.scene.getObjectByName('Sphere1');
|
|
12
|
+
sphere.material.depthTest = true;
|
|
13
|
+
|
|
14
|
+
const stripeBottom = model.scene.getObjectByName('Strip_Center_Big_(4th_-_Bottom_Layer)');
|
|
15
|
+
stripeBottom.material.depthTest = false;
|
|
16
|
+
stripeBottom.renderOrder = 1;
|
|
17
|
+
|
|
18
|
+
const stripeLeft = model.scene.getObjectByName('Strip_Left_(3rd)');
|
|
19
|
+
stripeLeft.material.depthTest = false;
|
|
20
|
+
stripeLeft.renderOrder = 2;
|
|
21
|
+
|
|
22
|
+
const stripeRight = model.scene.getObjectByName('Strip_Right_(2nd)');
|
|
23
|
+
stripeRight.material.depthTest = false;
|
|
24
|
+
stripeRight.renderOrder = 3;
|
|
25
|
+
|
|
26
|
+
const stripeTop = model.scene.getObjectByName('Strip_Center_(1st_-_Top_Layer)');
|
|
27
|
+
stripeTop.material.depthTest = false;
|
|
28
|
+
stripeTop.renderOrder = 4;
|
|
29
|
+
|
|
30
|
+
const card = model.scene.getObjectByName('Plane');
|
|
31
|
+
card.material.depthTest = false;
|
|
32
|
+
card.material.metalness = 0;
|
|
33
|
+
|
|
34
|
+
const animatedMaps = [sphere, stripeTop, stripeBottom, stripeLeft, stripeRight].map(
|
|
35
|
+
(object) => object.material.map,
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
useFrame(() => {
|
|
39
|
+
animatedMaps.forEach((map) => (map.offset.y += -0.0015));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<primitive scale={1.4} position={[0, -10, 0]} object={model.scene} />
|
|
45
|
+
<primitive object={lights} />
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default MarbleCard;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useGLTF, useAnimations } from '@react-three/drei';
|
|
2
|
+
import { useFrame, useLoader } from '@react-three/fiber';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { ObjectLoader, TextureLoader, Color } from 'three';
|
|
5
|
+
|
|
6
|
+
import { defineSrc } from '../utils';
|
|
7
|
+
|
|
8
|
+
const MultiCurrency = () => {
|
|
9
|
+
const ref = useRef();
|
|
10
|
+
const model = useGLTF(defineSrc(`multi-currency.gltf`));
|
|
11
|
+
|
|
12
|
+
const lights = useLoader(ObjectLoader, defineSrc('multi-currency-light.json'));
|
|
13
|
+
const wiseLogo = useLoader(TextureLoader, defineSrc('wise-flag-map-bump.jpg'));
|
|
14
|
+
|
|
15
|
+
const animatedMaps = [];
|
|
16
|
+
|
|
17
|
+
model.scene.traverse((child) => {
|
|
18
|
+
if (child.name.includes('Note')) {
|
|
19
|
+
child.castShadow = true;
|
|
20
|
+
child.receiveShadow = true;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (child.name.startsWith('Coin_') && child.isMesh) {
|
|
24
|
+
const { material } = child;
|
|
25
|
+
material.bumpMap = wiseLogo;
|
|
26
|
+
material.bumpMap.flipY = false;
|
|
27
|
+
material.bumpScale = 1;
|
|
28
|
+
material.color = new Color(0.49, 0.49, 0.49);
|
|
29
|
+
child.castShadow = false;
|
|
30
|
+
child.receiveShadow = false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (child.name.startsWith('NoteBase_') && child.isMesh) {
|
|
34
|
+
animatedMaps.push(child.material.map);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (child.name.includes('Wise') && child.isMesh) {
|
|
38
|
+
animatedMaps.push(child.material.map);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const { mixer, clips } = useAnimations(model.animations, ref);
|
|
43
|
+
useFrame(() => {
|
|
44
|
+
animatedMaps.forEach((animatedMap) => {
|
|
45
|
+
animatedMap.offset.x += 0.001;
|
|
46
|
+
});
|
|
47
|
+
mixer.clipAction(clips[0]).play();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
<primitive ref={ref} position={[-0.5, -10, 0]} scale={1.3} object={model.scene} />
|
|
53
|
+
<primitive object={lights} />
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default MultiCurrency;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useGLTF, useAnimations } from '@react-three/drei';
|
|
2
|
+
import { useFrame, useLoader } from '@react-three/fiber';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { ObjectLoader } from 'three';
|
|
5
|
+
|
|
6
|
+
import { defineSrc } from '../utils';
|
|
7
|
+
|
|
8
|
+
const Plane = () => {
|
|
9
|
+
const ref = useRef();
|
|
10
|
+
const model = useGLTF(defineSrc('plane.gltf'));
|
|
11
|
+
|
|
12
|
+
const lights = useLoader(ObjectLoader, defineSrc('plane-light.json'));
|
|
13
|
+
const plane = model.scene.getObjectByName('Plane_6_update');
|
|
14
|
+
|
|
15
|
+
const { mixer, clips } = useAnimations(model.animations, ref);
|
|
16
|
+
useFrame(() => {
|
|
17
|
+
model.materials['Tapestry WebGL'].map.offset.y += 0.018;
|
|
18
|
+
|
|
19
|
+
plane.position.x = 0.45;
|
|
20
|
+
|
|
21
|
+
plane.position.y = 7.5;
|
|
22
|
+
mixer.clipAction(clips[0]).play();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<>
|
|
27
|
+
<primitive ref={ref} scale={1.3} position={[0, -7, 0]} object={model.scene} />
|
|
28
|
+
<primitive object={lights} />
|
|
29
|
+
</>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default Plane;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
import type { IllustrationNames } from '../illustrations/metadata';
|
|
4
|
+
|
|
5
|
+
export function useBattery() {
|
|
6
|
+
const [batteryData, setBatteryData] = useState<{ level: number }>({ level: 1.0 });
|
|
7
|
+
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
const getBatteryData = async () => {
|
|
10
|
+
// @ts-expect-error .getBattery exists in Navigator interface
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
12
|
+
const battery = await navigator.getBattery();
|
|
13
|
+
|
|
14
|
+
setBatteryData({
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
16
|
+
level: battery?.level,
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
// Check if the browser supports the Battery API
|
|
20
|
+
if ('getBattery' in navigator) {
|
|
21
|
+
void getBatteryData();
|
|
22
|
+
}
|
|
23
|
+
}, []);
|
|
24
|
+
|
|
25
|
+
return batteryData;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function isBatteryLow(batteryLevel: number): boolean {
|
|
29
|
+
return batteryLevel < 0.2;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function isConnectionSlow(): boolean {
|
|
33
|
+
// @ts-expect-error .connection prop exists in Navigator interface
|
|
34
|
+
const { connection } = window.navigator;
|
|
35
|
+
if (connection === undefined) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return (
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
40
|
+
['slow-2g', '2g'].includes(connection?.effectiveType as string) ||
|
|
41
|
+
// @ts-expect-error Property 'connection' does exist on type 'Navigator'
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
43
|
+
navigator?.connection?.saveData === true
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function defineSrc(asset: string): string {
|
|
48
|
+
return `https://wise.com/web-art/assets/illustrations3d/${asset}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const illustration3DNames = [
|
|
52
|
+
'lock',
|
|
53
|
+
'globe',
|
|
54
|
+
'confetti',
|
|
55
|
+
'check-mark',
|
|
56
|
+
'flower',
|
|
57
|
+
'graph',
|
|
58
|
+
'jars',
|
|
59
|
+
'magnifying-glass',
|
|
60
|
+
'marble',
|
|
61
|
+
'marble-card',
|
|
62
|
+
'multi-currency',
|
|
63
|
+
'plane',
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
export function isIllustrationSupport3D(asset: IllustrationNames): boolean {
|
|
67
|
+
return illustration3DNames.includes(asset);
|
|
68
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export { Flag } from './flags';
|
|
2
2
|
export { default as Illustration } from './illustrations';
|
|
3
|
+
export { default as Illustration3D } from './illustrations3d';
|
|
4
|
+
|
|
3
5
|
export { Assets } from './illustrations';
|
|
4
6
|
export { Sizes } from './common';
|
|
5
7
|
|
|
6
8
|
export type { FlagProps } from './flags';
|
|
7
9
|
export type { IllustrationNames, IllustrationProps } from './illustrations';
|
|
10
|
+
export type { Illustration3DNames, Illustration3DProps } from './illustrations3d';
|
|
11
|
+
|
|
12
|
+
export { isIllustrationSupport3D } from './illustrations3d';
|