@anov/3d-ability 0.0.37 → 0.0.44

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.
@@ -0,0 +1,2 @@
1
+ import AnimationMotion from './motion';
2
+ export { AnimationMotion };
@@ -0,0 +1,3 @@
1
+ import AnimationMotion from "./motion";
2
+ export { AnimationMotion };
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AnimationMotion"],"sources":["../../src/animation/index.ts"],"sourcesContent":["import AnimationMotion from './motion'\n\nexport { AnimationMotion }"],"mappings":"AAAA,OAAOA,eAAe;AAEtB,SAASA,eAAe"}
@@ -0,0 +1,23 @@
1
+ import type { Curve, Object3D } from '@anov/3d-core';
2
+ import { CurvePath, Vector3 } from '@anov/3d-core';
3
+ type Option = Partial<{
4
+ speed: number;
5
+ duration: number;
6
+ paused: boolean;
7
+ repeat: number;
8
+ yoyo: boolean;
9
+ ease: string;
10
+ }>;
11
+ type Points = [number, number, number];
12
+ type Path = Points[] | Curve<Vector3>;
13
+ declare class AnimationMotion {
14
+ moveManage: any;
15
+ constructor(object: Object3D, path: Path, option?: Option);
16
+ getPath(points?: Points[]): CurvePath<Vector3>;
17
+ setSpeed(speed: Number): void;
18
+ play(): void;
19
+ pause(): void;
20
+ restart(): void;
21
+ delete(): void;
22
+ }
23
+ export default AnimationMotion;
@@ -0,0 +1,80 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
5
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
6
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
7
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ import { CurvePath, LineCurve3, Vector3, utils } from '@anov/3d-core';
11
+ /**
12
+ * 默认参数值
13
+ * speed: 运行速度
14
+ * duration: 运行总时长,当存在总时长时,优先总时长,忽略speed值
15
+ */
16
+ var defaultOption = {
17
+ speed: 2,
18
+ duration: null,
19
+ paused: false,
20
+ repeat: -1,
21
+ yoyo: false,
22
+ ease: 'power1.out'
23
+ };
24
+ var AnimationMotion = /*#__PURE__*/function () {
25
+ function AnimationMotion(object, path) {
26
+ var option = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
27
+ _classCallCheck(this, AnimationMotion);
28
+ _defineProperty(this, "moveManage", void 0);
29
+ var curvePath;
30
+ if (Array.isArray(path)) curvePath = this.getPath(path);else curvePath = path;
31
+ this.moveManage = utils.moveWithLine(object, curvePath, _objectSpread(_objectSpread({}, defaultOption), option));
32
+ }
33
+ _createClass(AnimationMotion, [{
34
+ key: "getPath",
35
+ value: function getPath() {
36
+ var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
37
+ var curvePath = new CurvePath();
38
+ if (points.length < 2) {
39
+ // 如果点数少于两个,返回空的 CurvePath
40
+ return curvePath;
41
+ }
42
+ points.forEach(function (point, index) {
43
+ var nextIndex = (index + 1) % points.length;
44
+ var startPoint = new Vector3().fromArray(point);
45
+ var endPoint = new Vector3().fromArray(points[nextIndex]);
46
+ var line = new LineCurve3(startPoint, endPoint);
47
+ curvePath.add(line);
48
+ });
49
+ return curvePath;
50
+ }
51
+ }, {
52
+ key: "setSpeed",
53
+ value: function setSpeed(speed) {
54
+ this.moveManage.setSpeed(speed);
55
+ }
56
+ }, {
57
+ key: "play",
58
+ value: function play() {
59
+ this.moveManage.continue();
60
+ }
61
+ }, {
62
+ key: "pause",
63
+ value: function pause() {
64
+ this.moveManage.stop();
65
+ }
66
+ }, {
67
+ key: "restart",
68
+ value: function restart() {
69
+ this.moveManage.restart();
70
+ }
71
+ }, {
72
+ key: "delete",
73
+ value: function _delete() {
74
+ this.moveManage.remove();
75
+ }
76
+ }]);
77
+ return AnimationMotion;
78
+ }();
79
+ export default AnimationMotion;
80
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CurvePath","LineCurve3","Vector3","utils","defaultOption","speed","duration","paused","repeat","yoyo","ease","AnimationMotion","object","path","option","arguments","length","undefined","_classCallCheck","_defineProperty","curvePath","Array","isArray","getPath","moveManage","moveWithLine","_objectSpread","_createClass","key","value","points","forEach","point","index","nextIndex","startPoint","fromArray","endPoint","line","add","setSpeed","play","continue","pause","stop","restart","_delete","remove"],"sources":["../../../src/animation/motion/index.ts"],"sourcesContent":["import type { Curve, Object3D } from '@anov/3d-core'\nimport { CurvePath, LineCurve3, Mesh, TubeGeometry, Vector3, utils } from '@anov/3d-core'\nimport type { LoopMode } from '../type'\n\ntype Option = Partial<{\n speed: number\n duration: number\n paused: boolean\n repeat: number\n yoyo: boolean\n ease: string\n}>\n\ntype Points = [number, number, number]\n\ntype Path = Points[] | Curve<Vector3>\n\n/**\n * 默认参数值\n * speed: 运行速度\n * duration: 运行总时长,当存在总时长时,优先总时长,忽略speed值\n */\nconst defaultOption: Option = {\n speed: 2,\n duration: null,\n paused: false,\n repeat: -1,\n yoyo: false,\n ease: 'power1.out',\n}\n\nclass AnimationMotion {\n moveManage: any\n constructor(object: Object3D, path: Path, option: Option = {}) {\n let curvePath\n if (Array.isArray(path))\n curvePath = this.getPath(path as Points[])\n else\n curvePath = path as Curve<Vector3>\n\n this.moveManage = utils.moveWithLine(object, curvePath, { ...defaultOption, ...option })\n }\n\n getPath(points: Points[] = []) {\n const curvePath = new CurvePath<Vector3>()\n if (points.length < 2) {\n // 如果点数少于两个,返回空的 CurvePath\n return curvePath\n }\n\n points.forEach((point, index) => {\n const nextIndex = (index + 1) % points.length\n const startPoint = new Vector3().fromArray(point)\n const endPoint = new Vector3().fromArray(points[nextIndex])\n const line = new LineCurve3(startPoint, endPoint)\n curvePath.add(line)\n })\n return curvePath\n }\n\n setSpeed(speed: Number) {\n this.moveManage.setSpeed(speed)\n }\n\n play() {\n this.moveManage.continue()\n }\n\n pause() {\n this.moveManage.stop()\n }\n\n restart() {\n this.moveManage.restart()\n }\n\n delete() {\n this.moveManage.remove()\n }\n}\n\nexport default AnimationMotion"],"mappings":";;;;;;;;;AACA,SAASA,SAAS,EAAEC,UAAU,EAAsBC,OAAO,EAAEC,KAAK,QAAQ,eAAe;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,CAAC,CAACkC,SAAS,CAACJ,KAAK,CAAC;QACjD,IAAMK,QAAQ,GAAG,IAAInC,OAAO,CAAC,CAAC,CAACkC,SAAS,CAACN,MAAM,CAACI,SAAS,CAAC,CAAC;QAC3D,IAAMI,IAAI,GAAG,IAAIrC,UAAU,CAACkC,UAAU,EAAEE,QAAQ,CAAC;QACjDjB,SAAS,CAACmB,GAAG,CAACD,IAAI,CAAC;MACrB,CAAC,CAAC;MACF,OAAOlB,SAAS;IAClB;EAAC;IAAAQ,GAAA;IAAAC,KAAA,EAED,SAAAW,SAASnC,KAAa,EAAE;MACtB,IAAI,CAACmB,UAAU,CAACgB,QAAQ,CAACnC,KAAK,CAAC;IACjC;EAAC;IAAAuB,GAAA;IAAAC,KAAA,EAED,SAAAY,KAAA,EAAO;MACL,IAAI,CAACjB,UAAU,CAACkB,QAAQ,CAAC,CAAC;IAC5B;EAAC;IAAAd,GAAA;IAAAC,KAAA,EAED,SAAAc,MAAA,EAAQ;MACN,IAAI,CAACnB,UAAU,CAACoB,IAAI,CAAC,CAAC;IACxB;EAAC;IAAAhB,GAAA;IAAAC,KAAA,EAED,SAAAgB,QAAA,EAAU;MACR,IAAI,CAACrB,UAAU,CAACqB,OAAO,CAAC,CAAC;IAC3B;EAAC;IAAAjB,GAAA;IAAAC,KAAA,EAED,SAAAiB,QAAA,EAAS;MACP,IAAI,CAACtB,UAAU,CAACuB,MAAM,CAAC,CAAC;IAC1B;EAAC;EAAA,OAAApC,eAAA;AAAA;AAGH,eAAeA,eAAe"}
@@ -0,0 +1,10 @@
1
+ export declare enum LoopMode {
2
+ none = "none",
3
+ yoyo = "yoyo",
4
+ repeat = "repeat"
5
+ }
6
+ export declare enum MotionState {
7
+ play = "play",
8
+ pause = "pause",
9
+ continue = "continue"
10
+ }
@@ -0,0 +1,16 @@
1
+ // 循环模式
2
+ export var LoopMode = /*#__PURE__*/function (LoopMode) {
3
+ LoopMode["none"] = "none";
4
+ LoopMode["yoyo"] = "yoyo";
5
+ LoopMode["repeat"] = "repeat";
6
+ return LoopMode;
7
+ }({});
8
+
9
+ // 运行状态
10
+ export var MotionState = /*#__PURE__*/function (MotionState) {
11
+ MotionState["play"] = "play";
12
+ MotionState["pause"] = "pause";
13
+ MotionState["continue"] = "continue";
14
+ return MotionState;
15
+ }({});
16
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LoopMode","MotionState"],"sources":["../../src/animation/type.ts"],"sourcesContent":["// 循环模式\nexport enum LoopMode {\n none = 'none',\n yoyo = 'yoyo',\n repeat = 'repeat',\n}\n\n// 运行状态\nexport enum MotionState {\n play = 'play',\n pause = 'pause',\n continue = 'continue',\n}"],"mappings":"AAAA;AACA,WAAYA,QAAQ,0BAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAARA,QAAQ;EAAA,OAARA,QAAQ;AAAA;;AAMpB;AACA,WAAYC,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA"}
@@ -0,0 +1,28 @@
1
+ import type { Camera } from '@anov/3d-core';
2
+ import { EventDispatcher, Vector3 } from '@anov/3d-core';
3
+ declare class FollowOrbitControls extends EventDispatcher {
4
+ radius: number;
5
+ target: Vector3;
6
+ private object;
7
+ private domElement;
8
+ private rotationH;
9
+ private rotationV;
10
+ private isMouseDown;
11
+ private isCurrentFirstMove;
12
+ private isGlobalFirstMove;
13
+ constructor(object: Camera, domElement: HTMLElement);
14
+ dispose(): void;
15
+ update(): void;
16
+ private getDistance;
17
+ private handleMouseup;
18
+ private handleMousedown;
19
+ /**
20
+ * handle Mousemove
21
+ * @param event
22
+ * @returns
23
+ */
24
+ private handleMousemove;
25
+ private handleWheelEvent;
26
+ private updateCameraPosition;
27
+ }
28
+ export default FollowOrbitControls;
@@ -0,0 +1,154 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
6
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
7
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
8
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
9
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
10
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
11
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
12
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
14
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
15
+ import { EventDispatcher, Vector3 } from '@anov/3d-core';
16
+ import { gsap } from 'gsap';
17
+ var FollowOrbitControls = /*#__PURE__*/function (_EventDispatcher) {
18
+ _inherits(FollowOrbitControls, _EventDispatcher);
19
+ var _super = _createSuper(FollowOrbitControls);
20
+ function FollowOrbitControls(object, domElement) {
21
+ var _this;
22
+ _classCallCheck(this, FollowOrbitControls);
23
+ _this = _super.call(this);
24
+ _defineProperty(_assertThisInitialized(_this), "radius", void 0);
25
+ _defineProperty(_assertThisInitialized(_this), "target", void 0);
26
+ _defineProperty(_assertThisInitialized(_this), "object", void 0);
27
+ _defineProperty(_assertThisInitialized(_this), "domElement", void 0);
28
+ _defineProperty(_assertThisInitialized(_this), "rotationH", void 0);
29
+ _defineProperty(_assertThisInitialized(_this), "rotationV", void 0);
30
+ _defineProperty(_assertThisInitialized(_this), "isMouseDown", void 0);
31
+ _defineProperty(_assertThisInitialized(_this), "isCurrentFirstMove", void 0);
32
+ _defineProperty(_assertThisInitialized(_this), "isGlobalFirstMove", void 0);
33
+ _this.object = object;
34
+ _this.domElement = domElement;
35
+ _this.target = new Vector3();
36
+ _this.radius = _this.getDistance();
37
+ _this.rotationH = Math.atan2(_this.object.position.x, _this.object.position.z);
38
+ _this.rotationV = Math.acos(_this.object.position.y / _this.radius);
39
+ _this.isMouseDown = false;
40
+ _this.isCurrentFirstMove = true;
41
+ _this.isGlobalFirstMove = true;
42
+ _this.domElement.addEventListener('mousedown', _this.handleMousedown.bind(_assertThisInitialized(_this)));
43
+ _this.domElement.addEventListener('mouseup', _this.handleMouseup.bind(_assertThisInitialized(_this)));
44
+ _this.domElement.addEventListener('mousemove', _this.handleMousemove.bind(_assertThisInitialized(_this)));
45
+ _this.domElement.addEventListener('wheel', _this.handleWheelEvent.bind(_assertThisInitialized(_this)));
46
+ return _this;
47
+ }
48
+ _createClass(FollowOrbitControls, [{
49
+ key: "dispose",
50
+ value: function dispose() {
51
+ this.domElement.removeEventListener('mousedown', this.handleMousedown.bind(this));
52
+ this.domElement.removeEventListener('mouseup', this.handleMouseup.bind(this));
53
+ this.domElement.removeEventListener('mousemove', this.handleMousemove.bind(this));
54
+ this.domElement.removeEventListener('wheel', this.handleWheelEvent.bind(this));
55
+ }
56
+ }, {
57
+ key: "update",
58
+ value: function update() {
59
+ this.object.lookAt(this.target);
60
+ }
61
+ }, {
62
+ key: "getDistance",
63
+ value: function getDistance() {
64
+ return this.object.position.distanceTo(this.target);
65
+ }
66
+ }, {
67
+ key: "handleMouseup",
68
+ value: function handleMouseup() {
69
+ this.isMouseDown = false;
70
+ }
71
+ }, {
72
+ key: "handleMousedown",
73
+ value: function handleMousedown() {
74
+ this.isMouseDown = true;
75
+ this.isCurrentFirstMove = true;
76
+ }
77
+
78
+ /**
79
+ * handle Mousemove
80
+ * @param event
81
+ * @returns
82
+ */
83
+ }, {
84
+ key: "handleMousemove",
85
+ value: function handleMousemove(event) {
86
+ if (!this.isMouseDown) return;
87
+ if (this.isGlobalFirstMove) {
88
+ this.isGlobalFirstMove = false;
89
+ this.dispatchEvent({
90
+ type: 'start'
91
+ });
92
+ }
93
+ if (this.isCurrentFirstMove) {
94
+ this.isCurrentFirstMove = false;
95
+ this.rotationH = Math.atan2(this.object.position.x, this.object.position.z);
96
+ this.rotationV = Math.acos(this.object.position.y / this.radius);
97
+ return;
98
+ }
99
+ this.rotationH -= event.movementX / 180 * Math.PI;
100
+ this.rotationV -= event.movementY / 180 * Math.PI;
101
+ if (this.rotationV < Math.PI / 180) this.rotationV = Math.PI / 180;
102
+ if (this.rotationV > Math.PI - Math.PI / 180) this.rotationV = Math.PI - Math.PI / 180;
103
+ this.updateCameraPosition();
104
+ }
105
+ }, {
106
+ key: "handleWheelEvent",
107
+ value: function handleWheelEvent(event) {
108
+ var _this2 = this;
109
+ event.preventDefault();
110
+ if (this.isGlobalFirstMove) {
111
+ this.isGlobalFirstMove = false;
112
+ this.dispatchEvent({
113
+ type: 'start'
114
+ });
115
+ }
116
+ if (this.isCurrentFirstMove) {
117
+ this.isCurrentFirstMove = false;
118
+ this.rotationH = Math.atan2(this.object.position.x, this.object.position.z);
119
+ this.rotationV = Math.acos(this.object.position.y / this.radius);
120
+ return;
121
+ }
122
+ var zoomSpeed = 0.3;
123
+ var minRadius = 0.1;
124
+ var maxRadius = 100000;
125
+ var targetRadius = this.radius + event.deltaY * zoomSpeed;
126
+ var clampedRadius = Math.max(minRadius, Math.min(maxRadius, targetRadius));
127
+
128
+ // TODO: 优化 统一在updateCameraPosition处理
129
+ gsap.to(this, {
130
+ duration: 0.2,
131
+ radius: clampedRadius,
132
+ ease: 'power3.out',
133
+ onUpdate: function onUpdate() {
134
+ _this2.updateCameraPosition();
135
+ }
136
+ });
137
+ }
138
+ }, {
139
+ key: "updateCameraPosition",
140
+ value: function updateCameraPosition() {
141
+ // TODO: 有些生硬,加些过度动画
142
+ this.object.position.set(this.radius * Math.sin(this.rotationV) * Math.sin(this.rotationH), this.radius * Math.cos(this.rotationV), this.radius * Math.sin(this.rotationV) * Math.cos(this.rotationH));
143
+ this.update();
144
+ this.dispatchEvent({
145
+ type: 'change',
146
+ position: this.object.position,
147
+ target: this.target
148
+ });
149
+ }
150
+ }]);
151
+ return FollowOrbitControls;
152
+ }(EventDispatcher);
153
+ export default FollowOrbitControls;
154
+ //# sourceMappingURL=FollowOrbitControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EventDispatcher","Vector3","gsap","FollowOrbitControls","_EventDispatcher","_inherits","_super","_createSuper","object","domElement","_this","_classCallCheck","call","_defineProperty","_assertThisInitialized","target","radius","getDistance","rotationH","Math","atan2","position","x","z","rotationV","acos","y","isMouseDown","isCurrentFirstMove","isGlobalFirstMove","addEventListener","handleMousedown","bind","handleMouseup","handleMousemove","handleWheelEvent","_createClass","key","value","dispose","removeEventListener","update","lookAt","distanceTo","event","dispatchEvent","type","movementX","PI","movementY","updateCameraPosition","_this2","preventDefault","zoomSpeed","minRadius","maxRadius","targetRadius","deltaY","clampedRadius","max","min","to","duration","ease","onUpdate","set","sin","cos"],"sources":["../../src/camera/FollowOrbitControls.ts"],"sourcesContent":["import type { Camera } from '@anov/3d-core'\nimport { EventDispatcher, Vector3 } from '@anov/3d-core'\nimport { gsap } from 'gsap'\n\nclass FollowOrbitControls extends EventDispatcher {\n radius: number\n target: Vector3\n\n private object: Camera\n private domElement: HTMLElement\n\n private rotationH: number\n private rotationV: number\n private isMouseDown: boolean\n private isCurrentFirstMove: boolean\n private isGlobalFirstMove: boolean\n\n constructor(object: Camera, domElement: HTMLElement) {\n super()\n\n this.object = object\n this.domElement = domElement\n this.target = new Vector3()\n this.radius = this.getDistance()\n this.rotationH = Math.atan2(this.object.position.x, this.object.position.z)\n this.rotationV = Math.acos(this.object.position.y / this.radius)\n\n this.isMouseDown = false\n this.isCurrentFirstMove = true\n this.isGlobalFirstMove = true\n\n this.domElement.addEventListener('mousedown', this.handleMousedown.bind(this))\n this.domElement.addEventListener('mouseup', this.handleMouseup.bind(this))\n this.domElement.addEventListener('mousemove', this.handleMousemove.bind(this))\n this.domElement.addEventListener('wheel', this.handleWheelEvent.bind(this))\n }\n\n dispose() {\n this.domElement.removeEventListener('mousedown', this.handleMousedown.bind(this))\n this.domElement.removeEventListener('mouseup', this.handleMouseup.bind(this))\n this.domElement.removeEventListener('mousemove', this.handleMousemove.bind(this))\n this.domElement.removeEventListener('wheel', this.handleWheelEvent.bind(this))\n }\n\n update() {\n this.object.lookAt(this.target)\n }\n\n private getDistance() {\n return this.object.position.distanceTo(this.target)\n }\n\n private handleMouseup() {\n this.isMouseDown = false\n }\n\n private handleMousedown() {\n this.isMouseDown = true\n this.isCurrentFirstMove = true\n }\n\n /**\n * handle Mousemove\n * @param event\n * @returns\n */\n private handleMousemove(event: MouseEvent) {\n if (!this.isMouseDown)\n return\n\n if (this.isGlobalFirstMove) {\n this.isGlobalFirstMove = false\n this.dispatchEvent({\n type: 'start',\n })\n }\n\n if (this.isCurrentFirstMove) {\n this.isCurrentFirstMove = false\n this.rotationH = Math.atan2(this.object.position.x, this.object.position.z)\n this.rotationV = Math.acos(this.object.position.y / this.radius)\n\n return\n }\n\n this.rotationH -= (event.movementX / 180) * Math.PI\n this.rotationV -= (event.movementY / 180) * Math.PI\n\n if (this.rotationV < Math.PI / 180)\n this.rotationV = Math.PI / 180\n if (this.rotationV > Math.PI - Math.PI / 180)\n this.rotationV = Math.PI - Math.PI / 180\n\n this.updateCameraPosition()\n }\n\n private handleWheelEvent(event: WheelEvent) {\n event.preventDefault()\n\n if (this.isGlobalFirstMove) {\n this.isGlobalFirstMove = false\n this.dispatchEvent({\n type: 'start',\n })\n }\n\n if (this.isCurrentFirstMove) {\n this.isCurrentFirstMove = false\n this.rotationH = Math.atan2(this.object.position.x, this.object.position.z)\n this.rotationV = Math.acos(this.object.position.y / this.radius)\n\n return\n }\n\n const zoomSpeed = 0.3\n const minRadius = 0.1\n const maxRadius = 100000\n const targetRadius = this.radius + event.deltaY * zoomSpeed\n const clampedRadius = Math.max(minRadius, Math.min(maxRadius, targetRadius))\n\n // TODO: 优化 统一在updateCameraPosition处理\n gsap.to(this, {\n duration: 0.2,\n radius: clampedRadius,\n ease: 'power3.out',\n onUpdate: () => {\n this.updateCameraPosition()\n },\n })\n }\n\n private updateCameraPosition() {\n // TODO: 有些生硬,加些过度动画\n this.object.position.set(\n this.radius * Math.sin(this.rotationV) * Math.sin(this.rotationH),\n this.radius * Math.cos(this.rotationV),\n this.radius * Math.sin(this.rotationV) * Math.cos(this.rotationH),\n )\n\n this.update()\n\n this.dispatchEvent({\n type: 'change',\n position: this.object.position,\n target: this.target,\n })\n }\n}\n\nexport default FollowOrbitControls\n"],"mappings":";;;;;;;;;;;;;;AACA,SAASA,eAAe,EAAEC,OAAO,QAAQ,eAAe;AACxD,SAASC,IAAI,QAAQ,MAAM;AAAA,IAErBC,mBAAmB,0BAAAC,gBAAA;EAAAC,SAAA,CAAAF,mBAAA,EAAAC,gBAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,mBAAA;EAavB,SAAAA,oBAAYK,MAAc,EAAEC,UAAuB,EAAE;IAAA,IAAAC,KAAA;IAAAC,eAAA,OAAAR,mBAAA;IACnDO,KAAA,GAAAJ,MAAA,CAAAM,IAAA;IAAOC,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IAAAG,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IAAAG,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IAAAG,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IAAAG,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IAAAG,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IAAAG,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IAAAG,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IAAAG,eAAA,CAAAC,sBAAA,CAAAJ,KAAA;IAEPA,KAAA,CAAKF,MAAM,GAAGA,MAAM;IACpBE,KAAA,CAAKD,UAAU,GAAGA,UAAU;IAC5BC,KA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AAC,EACjE,IAAI,CAACF,MAAM,GAAGG,IAAI,CAACgD,GAAG,CAAC,IAAI,CAAC3C,SAAS,CAAC,EACtC,IAAI,CAACR,MAAM,GAAGG,IAAI,CAAC+C,GAAG,CAAC,IAAI,CAAC1C,SAAS,CAAC,GAAGL,IAAI,CAACgD,GAAG,CAAC,IAAI,CAACjD,SAAS,CAClE,CAAC;MAED,IAAI,CAACuB,MAAM,CAAC,CAAC;MAEb,IAAI,CAACI,aAAa,CAAC;QACjBC,IAAI,EAAE,QAAQ;QACdzB,QAAQ,EAAE,IAAI,CAACb,MAAM,CAACa,QAAQ;QAC9BN,MAAM,EAAE,IAAI,CAACA;MACf,CAAC,CAAC;IACJ;EAAC;EAAA,OAAAZ,mBAAA;AAAA,EA9I+BH,eAAe;AAiJjD,eAAeG,mBAAmB"}
@@ -0,0 +1,2 @@
1
+ import CameraControls from 'camera-controls';
2
+ export default CameraControls;
@@ -0,0 +1,18 @@
1
+ import { Box3, Matrix4, Quaternion, Raycaster, Sphere, Spherical, Vector2, Vector3, Vector4 } from '@anov/3d-core';
2
+ import CameraControls from 'camera-controls';
3
+ var subsetOfTHREE = {
4
+ Vector2: Vector2,
5
+ Vector3: Vector3,
6
+ Vector4: Vector4,
7
+ Quaternion: Quaternion,
8
+ Matrix4: Matrix4,
9
+ Spherical: Spherical,
10
+ Box3: Box3,
11
+ Sphere: Sphere,
12
+ Raycaster: Raycaster
13
+ };
14
+ CameraControls.install({
15
+ THREE: subsetOfTHREE
16
+ });
17
+ export default CameraControls;
18
+ //# sourceMappingURL=controls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Box3","Matrix4","Quaternion","Raycaster","Sphere","Spherical","Vector2","Vector3","Vector4","CameraControls","subsetOfTHREE","install","THREE"],"sources":["../../src/camera/controls.ts"],"sourcesContent":["import { Box3, Matrix4, Quaternion, Raycaster, Sphere, Spherical, Vector2, Vector3, Vector4 } from '@anov/3d-core'\nimport CameraControls from 'camera-controls'\n\nconst subsetOfTHREE = {\n Vector2,\n Vector3,\n Vector4,\n Quaternion,\n Matrix4,\n Spherical,\n Box3,\n Sphere,\n Raycaster,\n}\n\nCameraControls.install({ THREE: subsetOfTHREE })\n\nexport default CameraControls"],"mappings":"AAAA,SAASA,IAAI,EAAEC,OAAO,EAAEC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAEC,SAAS,EAAEC,OAAO,EAAEC,OAAO,EAAEC,OAAO,QAAQ,eAAe;AAClH,OAAOC,cAAc,MAAM,iBAAiB;AAE5C,IAAMC,aAAa,GAAG;EACpBJ,OAAO,EAAPA,OAAO;EACPC,OAAO,EAAPA,OAAO;EACPC,OAAO,EAAPA,OAAO;EACPN,UAAU,EAAVA,UAAU;EACVD,OAAO,EAAPA,OAAO;EACPI,SAAS,EAATA,SAAS;EACTL,IAAI,EAAJA,IAAI;EACJI,MAAM,EAANA,MAAM;EACND,SAAS,EAATA;AACF,CAAC;AAEDM,cAAc,CAACE,OAAO,CAAC;EAAEC,KAAK,EAAEF;AAAc,CAAC,CAAC;AAEhD,eAAeD,cAAc"}
@@ -1,4 +1,4 @@
1
- import type { OrbitControls, PerspectiveCamera, SceneControl } from '@anov/3d-core';
1
+ import type { Object3D, OrbitControls, PerspectiveCamera, SceneControl } from '@anov/3d-core';
2
2
  import { EventDispatcher, Vector3 } from '@anov/3d-core';
3
3
  type vector3Array = number[];
4
4
  declare class CameraUtil extends EventDispatcher {
@@ -8,6 +8,10 @@ declare class CameraUtil extends EventDispatcher {
8
8
  private controls;
9
9
  private sceneControl;
10
10
  private tween;
11
+ private isCameraChange;
12
+ private isCameraChanged;
13
+ private followId;
14
+ private followCancelMap;
11
15
  constructor(camera: PerspectiveCamera, controls: OrbitControls, sceneControl: SceneControl);
12
16
  /**
13
17
  * calculate last position from position box
@@ -17,14 +21,6 @@ declare class CameraUtil extends EventDispatcher {
17
21
  * @returns
18
22
  */
19
23
  private caclCurrentPos;
20
- /**
21
- * get current camera pitch and yaw
22
- * @param pitch
23
- * @param target
24
- * @param position
25
- * @returns
26
- */
27
- private caclTargetByPitch;
28
24
  /**
29
25
  * caclSingleCoordinate, when use focus and target is single point
30
26
  * @param prevTarget
@@ -83,6 +79,37 @@ declare class CameraUtil extends EventDispatcher {
83
79
  position: number[];
84
80
  target: number[];
85
81
  };
82
+ getCurrentPitch(): number;
83
+ getCurrentYaw(): any;
84
+ setPitch(deg: number): void;
85
+ setYaw(deg: number): void;
86
+ /**
87
+ * cacl Position By Follow
88
+ * @param container
89
+ * @param pitch
90
+ * @param yaw
91
+ * @param distance
92
+ */
93
+ private caclPositionByFollow;
94
+ /**
95
+ * follow 3d object, not only use in camera
96
+ * @param target
97
+ */
98
+ follow(target: Object3D, camera: PerspectiveCamera, option?: Partial<{
99
+ relativeRotation: boolean;
100
+ pitch: number;
101
+ yaw: number;
102
+ distance: number;
103
+ }>): number;
104
+ /**
105
+ * cancel follow
106
+ * @param followId
107
+ */
108
+ cancelFollow(followId: number): void;
109
+ /**
110
+ * cancel all follow
111
+ */
112
+ cancelAllFollow(): void;
86
113
  /**
87
114
  * interpolation move camera
88
115
  * @param position