MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / initThree

Function initThree

public/iframe/lib/js/mixinsThree.js:10–500  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8Vue.mixin({
9 methods: {
10 initThree () {
11 Vue.component('x-queue', {
12 props: {
13 option: {
14 type: Object,
15 default: () => {
16 return {};
17 },
18 },
19 id: {
20 type: String,
21 default: ''
22 }
23 },
24 data () {
25 return {
26 targets: {
27 grid: [],
28 helix: [],
29 sphere: [],
30 },
31 objects: [],
32 renderer: null,
33 scene: null,
34 camera: null,
35 controls: null,
36 }
37 },
38 mounted () {
39 this.init()
40 this.animation();
41 },
42 beforeDestroy () {
43 this.controls.removeEventListener('change', this.render);
44
45 },
46 watch: {
47 'option.selectStatus.default': {
48 handler (newVal) {
49 this.transform(this.targets[newVal], 2000)
50 },
51 immediate: true,
52 },
53 },
54 methods: {
55 transform (targets, duration) {
56 const objLength = this.objects.length;
57 // this.nowStatus = status
58 TWEEN.removeAll();
59 for (let i = 0; i < objLength; ++i) {
60
61 const object = this.objects[i];
62 const target = targets[i];
63 new TWEEN.Tween(object.position)
64 .to({ x: target.position.x, y: target.position.y, z: target.position.z },
65 Math.random() * duration + duration)
66 .easing(TWEEN.Easing.Exponential.InOut)
67 .start();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected