flowerBox.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. setTimeout(()=>{
  44. this.replace();
  45. },100)
  46. },
  47. // 复位
  48. replace: function(){
  49. this.animation = wx.createAnimation({
  50. duration: 17,
  51. timingFunction: 'linear',
  52. })
  53. this.animation.opacity(1).step();
  54. this.animation.bottom('-120rpx').step();
  55. this.setData({
  56. animationData: this.animation.export()
  57. })
  58. }
  59. }
  60. })