Skip to content

Commit 0b62164

Browse files
committed
chore:export gsap function
1 parent b6b43da commit 0b62164

File tree

2 files changed

+79
-36
lines changed

2 files changed

+79
-36
lines changed

packages/core/main.ts

Lines changed: 74 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,85 @@
11
import * as AUTO from "./src/index";
2-
import * as THREE from "three";
3-
import ChinaJson from '../examples/public/China.json'
42

5-
new AUTO.ThreeAuto(undefined, {
6-
size: {
7-
type: 'window',
3+
4+
const instance = new AUTO.ThreeAuto(undefined, {
5+
camera: {
6+
type: 'PerspectiveCamera',
7+
fov: 60,
8+
near: 1,
9+
far: 1000,
10+
position: {
11+
x: 20,
12+
y: 20,
13+
z: 0,
14+
},
15+
lookAt: true,
16+
controls: {
17+
enable: false,
18+
enableDamping: false,
19+
enablePan: false,
20+
},
821
},
922
series: [
1023
{
11-
name: 'earth',
12-
type: 'earth',
13-
atmosphereDayColor: '#00aaff',
14-
atmosphereTwilightColor: '#ff6600',
15-
atmosphereThickness: 1.04,
16-
rotation: true,
17-
radius: 20,
18-
json: ChinaJson,
24+
type: 'pie',
25+
name: 'three-auto-pie',
26+
shadow: false,
1927
data: [
20-
{ name: '曼谷', value: 100, color: '#fcc02a', lng: 100.49074172973633,lat: 22 },
21-
{ name: '澳大利亚', value: 200, color: '#f16b91', lng: 133,lat: -23.68477416688374 },
22-
{ name: '新疆维吾尔自治区', value: 300, color: '#187bac', lng: 85,lat: 42 },
23-
{ name: '德黑兰', value: 500, color: '#eeeeee', lng: 51,lat: 35 },
24-
{ name: '美国', value: 1000, color: '#ccc', lng: 241,lat: 34 },
25-
{ name: '英国', value: 400, color: '#000', lng: 359,lat: 51 },
26-
{ name: '巴西', value: 500, color: '#3e1', lng: 668,lat: -9 },
27-
{ name: '西藏', value: 200, color: '#9e2', lng: 91,lat: 29 },
28-
{ name: '广西', value: 100, color: '#cf1', lng: 108,lat: 22 },
29-
{ name: '江西', value: 0, color: '#cf2', lng: 115,lat: 28 },
28+
{ name: '报修', value: 40, color: '#52E4AC' },
29+
{ name: '安全', value: 20, color: '#1561EC' },
30+
{ name: '环境', value: 25, color: '#FED859' },
31+
{ name: '服务', value: 15, color: '#22B6E7' },
3032
],
31-
},
32-
],
33-
camera: {
34-
fov: 75,
35-
near: 0.1,
36-
far: 1000,
37-
position: {
38-
z: 40,
33+
transparent: true,
34+
opacity: 0.5,
35+
selectedMode: '',
36+
selectedOffset: 1,
37+
height: 1,
38+
heightMode: 'flat',
39+
radius: [8, 10],
40+
gap: 0.1,
41+
eventName: 'click',
42+
label: {
43+
show: true,
44+
distance: 0,
45+
scale: 1,
46+
rotation: {
47+
x: 0,
48+
y: 0,
49+
z: 0,
50+
},
51+
textStyle: {
52+
padding: '6px',
53+
'font-size': '16px',
54+
color: "#000",
55+
bold: true,
56+
'font-weight': 400,
57+
'font-style': 'normal',
58+
},
59+
},
60+
tooltip: {
61+
className: 'three-auto-tooltip',
62+
background: 'rgba(255,255,255,1)',
63+
show: true,
64+
borderWidth: 1,
65+
padding: '15px 20px',
66+
hideDelay: 100,
67+
textStyle: {
68+
'font-size': '18px',
69+
color: "#000000",
70+
'font-weight': 400,
71+
'font-style': 'normal',
72+
},
73+
}
3974
}
40-
},
41-
renderer: {
42-
clearColor: '#000',
43-
clearAlpha: 1,
44-
}
75+
],
76+
77+
});
78+
79+
80+
instance.camera.instance.updateProjectionMatrix()
81+
instance._renderer.setClearColor("#DDEAFB");
82+
instance.onTick(() => {
4583
});
4684

4785

packages/core/src/base/ThreeInstance.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import * as THREE from "three";
2+
import gsap from "gsap";
3+
import { MotionPathPlugin } from 'gsap/MotionPathPlugin';
24

35
import { ConfigType } from "../types/ConfigType";
46
import { CONFIG } from "../config/config";
@@ -33,6 +35,9 @@ export interface ThreeInstance {
3335
createTips(root: HTMLElement): any
3436
}
3537
class ThreeAuto implements ThreeInstance {
38+
public static gsap = gsap;
39+
public static MotionPathPlugin = MotionPathPlugin;
40+
3641
public tips: Tips;
3742
public time: Time;
3843
public scene: THREE.Scene;

0 commit comments

Comments
 (0)