flowerBox.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. Component({
  2. /**
  3. * 组件的属性列表
  4. */
  5. properties: {
  6. flowerNum: {
  7. type: Number,
  8. value: 1
  9. }
  10. },
  11. /**
  12. * 组件的初始数据
  13. */
  14. data: {
  15. flag: true,
  16. },
  17. /**
  18. * 组件的方法列表
  19. */
  20. methods: {
  21. comeOut: function(){
  22. this.animation = wx.createAnimation({
  23. duration: 700,
  24. timingFunction: 'ease',
  25. })
  26. this.animation.bottom('350rpx').step();
  27. this.setData({
  28. animationData: this.animation.export()
  29. })
  30. setTimeout(()=>{
  31. this.close()
  32. },2000);
  33. },
  34. close: function (e) {
  35. this.animation = wx.createAnimation({
  36. duration: 400,
  37. timingFunction: 'ease',
  38. })
  39. this.animation.opacity(0).step();
  40. this.setData({
  41. animationData: this.animation.export()
  42. })
  43. this.replace();
  44. },
  45. // 复位
  46. replace: function(){
  47. this.animation = wx.createAnimation({
  48. duration: 1,
  49. timingFunction: 'linear',
  50. })
  51. this.animation.opacity(1).step();
  52. this.animation.bottom('-100rpx').step();
  53. this.setData({
  54. animationData: this.animation.export()
  55. })
  56. }
  57. }
  58. })