|
@@ -1,16 +1,93 @@
|
|
Component({
|
|
Component({
|
|
behaviors: [require('../common/share-behavior').default],
|
|
behaviors: [require('../common/share-behavior').default],
|
|
- properties: {},
|
|
|
|
|
|
+ properties: {
|
|
|
|
+ captureState: {
|
|
|
|
+ type: Number,
|
|
|
|
+ value: 0,
|
|
|
|
+ observer: function (newVal, oldVal) {
|
|
|
|
+ if (newVal !== oldVal) {
|
|
|
|
+ if (newVal === 1) {
|
|
|
|
+ this.capture();
|
|
|
|
+ this.ShowModel();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ recordState: {
|
|
|
|
+ type: Number,
|
|
|
|
+ value: 0,
|
|
|
|
+ observer: function (newVal, oldVal) {
|
|
|
|
+ if (newVal !== oldVal) {
|
|
|
|
+ if (newVal === 0) {
|
|
|
|
+ this.recordEnd();
|
|
|
|
+ } else {
|
|
|
|
+ this.recordStart();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ captureQuality: {
|
|
|
|
+ type: Number,
|
|
|
|
+ value: 0.8,
|
|
|
|
+ },
|
|
|
|
+ captureType: {
|
|
|
|
+ type: String,
|
|
|
|
+ value: 'jpg',
|
|
|
|
+ },
|
|
|
|
+ recordFPS: {
|
|
|
|
+ type: Number,
|
|
|
|
+ value: 30,
|
|
|
|
+ },
|
|
|
|
+ recordWidth: {
|
|
|
|
+ type: Number,
|
|
|
|
+ value: undefined,
|
|
|
|
+ },
|
|
|
|
+ recordHeight: {
|
|
|
|
+ type: Number,
|
|
|
|
+ value: undefined,
|
|
|
|
+ },
|
|
|
|
+ recordBPS: {
|
|
|
|
+ type: Number,
|
|
|
|
+ value: 1000,
|
|
|
|
+ },
|
|
|
|
+ uiShowModelView:{
|
|
|
|
+ type: Boolean,
|
|
|
|
+ value: false,
|
|
|
|
+ observer: function (newVal, oldVal) {
|
|
|
|
+
|
|
|
|
+ if (newVal !== oldVal) {
|
|
|
|
+ if(newVal){
|
|
|
|
+ //this.ShowModel(1);
|
|
|
|
+ }else{
|
|
|
|
+ this.CloseModel();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ },
|
|
|
|
+ uiShowIndex:{
|
|
|
|
+ type: Number,
|
|
|
|
+ value: 0,
|
|
|
|
+ observer: function (newVal, oldVal) {
|
|
|
|
+ if (newVal !== oldVal) {
|
|
|
|
+ this.ShowModel(newVal);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ }
|
|
|
|
+ },
|
|
data: {
|
|
data: {
|
|
|
|
+ loaded: false,
|
|
loadedSaoMiao:false,
|
|
loadedSaoMiao:false,
|
|
loaded: false,
|
|
loaded: false,
|
|
arReady: false,
|
|
arReady: false,
|
|
loaded2:false,
|
|
loaded2:false,
|
|
position2:[0,0,0],
|
|
position2:[0,0,0],
|
|
rot:0,
|
|
rot:0,
|
|
- str:"1"
|
|
|
|
-
|
|
|
|
|
|
+ str:"1",
|
|
|
|
+ longshow : false,
|
|
|
|
+ binglongshow:false,
|
|
|
|
+ lanjiachongshow:false,
|
|
},
|
|
},
|
|
|
|
+
|
|
lifetimes: {
|
|
lifetimes: {
|
|
async attached() {
|
|
async attached() {
|
|
console.log('data', this.data);
|
|
console.log('data', this.data);
|
|
@@ -22,6 +99,17 @@ Component({
|
|
console.log('xr-scene', xrScene);
|
|
console.log('xr-scene', xrScene);
|
|
|
|
|
|
this.binglong = {el:this.scene.getElementById('binglong')};
|
|
this.binglong = {el:this.scene.getElementById('binglong')};
|
|
|
|
+
|
|
|
|
+ const scene = this.scene = detail.value;
|
|
|
|
+ const appHide = () => this.scene.share.recordPause();
|
|
|
|
+ const appShow = () => this.scene.share.recordResume();
|
|
|
|
+ wx.onAppHide(appHide);
|
|
|
|
+ wx.onAppShow(appShow);
|
|
|
|
+ wx.offAppHide(appHide);
|
|
|
|
+ wx.offAppShow(appShow);
|
|
|
|
+
|
|
|
|
+ this.triggerEvent('sceneReady', {width: scene.width, height: scene.height});
|
|
|
|
+
|
|
},
|
|
},
|
|
handleAssetsProgress: function({detail}) {
|
|
handleAssetsProgress: function({detail}) {
|
|
this.triggerEvent('assetsProgress', detail.value);
|
|
this.triggerEvent('assetsProgress', detail.value);
|
|
@@ -32,6 +120,7 @@ Component({
|
|
this.setData({
|
|
this.setData({
|
|
loaded: true
|
|
loaded: true
|
|
});
|
|
});
|
|
|
|
+
|
|
},handleGltfLoaded2: function() {
|
|
},handleGltfLoaded2: function() {
|
|
|
|
|
|
},handleGltfLoaded: function() {
|
|
},handleGltfLoaded: function() {
|
|
@@ -74,10 +163,27 @@ Component({
|
|
handleGLTFLoadedbingLong:function({detail}){
|
|
handleGLTFLoadedbingLong:function({detail}){
|
|
const el2 = detail.value;
|
|
const el2 = detail.value;
|
|
const el = detail.value.target;
|
|
const el = detail.value.target;
|
|
- const animator = el.getComponent("animator");
|
|
|
|
|
|
+ const animator = el.getComponent(xrFrameSystem.Animator);
|
|
//animator.play("ui_motion_1");
|
|
//animator.play("ui_motion_1");
|
|
- animator.play("m_13jzq_run");
|
|
|
|
|
|
+
|
|
var state = true;
|
|
var state = true;
|
|
|
|
+
|
|
|
|
+ const xrScene = this.scene;
|
|
|
|
+ const xrFrameSystem = wx.getXrFrameSystem();
|
|
|
|
+ const myModel = xrScene.getElementById('binglong');
|
|
|
|
+ this.myModelAnimator = myModel.getComponent(xrFrameSystem.Animator);
|
|
|
|
+ const clips = this.myModelAnimator._clips;
|
|
|
|
+ this.clipName = []
|
|
|
|
+ clips.forEach((v, key) => {
|
|
|
|
+ if (key.indexOf('pose') == -1) {
|
|
|
|
+ this.clipName.push(key)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ wx.showToast({
|
|
|
|
+ title: this.clipName[0],
|
|
|
|
+ });
|
|
|
|
+ this.myModelAnimator.play.play(this.clipName[0],{ loop:5,});
|
|
|
|
+
|
|
var interval = setInterval(function() {
|
|
var interval = setInterval(function() {
|
|
if(false)
|
|
if(false)
|
|
{
|
|
{
|
|
@@ -87,25 +193,75 @@ Component({
|
|
if(state)
|
|
if(state)
|
|
{
|
|
{
|
|
state = false;
|
|
state = false;
|
|
- animator.play("m_13jzq_stand");
|
|
|
|
|
|
+ this.myModelAnimator.play.play(this.clipName[1],{ loop:5,});
|
|
}else{
|
|
}else{
|
|
state = true;
|
|
state = true;
|
|
- animator.play("ui_motion_1");
|
|
|
|
|
|
+ this.myModelAnimator.play.play(this.clipName[2],{ loop:5,});
|
|
el2.position =(0 -2.5 -40);
|
|
el2.position =(0 -2.5 -40);
|
|
}
|
|
}
|
|
|
|
|
|
}, 5000)
|
|
}, 5000)
|
|
- var interval2 = setInterval(function() {
|
|
|
|
- if(false)
|
|
|
|
- {
|
|
|
|
- clearInterval(interval2);
|
|
|
|
- }
|
|
|
|
- console.log(5000 +" 毫秒更新");
|
|
|
|
- binglong.position =(0 -2.5 -40);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }, 5000)
|
|
|
|
|
|
|
|
|
|
+ },
|
|
|
|
+ capture() {
|
|
|
|
+ this.scene.share.captureToFriends({
|
|
|
|
+ fileType: this.data.captureType,
|
|
|
|
+ quality: this.data.captureQuality
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ recordStart() {
|
|
|
|
+ console.log('recordStart')
|
|
|
|
+ wx.updateShareMenu({
|
|
|
|
+ withShareTicket: true,
|
|
|
|
+ success () { }
|
|
|
|
+ })
|
|
|
|
+ this.scene.share.recordStart({
|
|
|
|
+ fps: this.data.recordFPS,
|
|
|
|
+ videoBitsPerSecond: this.data.recordBPS,
|
|
|
|
+ width: this.data.recordWidth,
|
|
|
|
+ height: this.data.recordHeight
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ recordEnd() {
|
|
|
|
+ console.log('recordEnd')
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //
|
|
|
|
+ const tempFilePath = this.scene.share.recordFinishToAlbum({
|
|
|
|
+ fps: this.data.recordFPS,
|
|
|
|
+ videoBitsPerSecond: this.data.recordBPS,
|
|
|
|
+ width: this.data.recordWidth,
|
|
|
|
+ height: this.data.recordHeight
|
|
|
|
+ });
|
|
|
|
+ wx.shareVideoMessage({
|
|
|
|
+ videoPath: tempFilePath,
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ ShowModel(modelIndex){
|
|
|
|
+
|
|
|
|
+ switch(modelIndex){
|
|
|
|
+ case 0:
|
|
|
|
+ this.setData({longshow:true});
|
|
|
|
+ this.setData({binglongshow:false});
|
|
|
|
+ this.setData({lanjiachongshow:false});
|
|
|
|
+ break;
|
|
|
|
+ case 1:
|
|
|
|
+ this.setData({longshow:false});
|
|
|
|
+ this.setData({binglongshow:true});
|
|
|
|
+ this.setData({lanjiachongshow:false});
|
|
|
|
+ break;
|
|
|
|
+ case 2:
|
|
|
|
+ this.setData({longshow:false});
|
|
|
|
+ this.setData({binglongshow:false});
|
|
|
|
+ this.setData({lanjiachongshow:true});
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ },
|
|
|
|
+ CloseModel(){
|
|
|
|
+ this.setData({longshow:false});
|
|
|
|
+ this.setData({binglongshow:false});
|
|
|
|
+ this.setData({lanjiachongshow:false});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|