index.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. export default {
  2. data: {
  3. animMaskData: [],
  4. animContentData: [],
  5. },
  6. animOp: {
  7. createMaskShowAnim() {
  8. const animation = my.createAnimation({
  9. duration: 200,
  10. timingFunction: 'cubic-bezier(.55, 0, .55, .2)',
  11. });
  12. this.maskAnim = animation;
  13. animation.opacity(1).step();
  14. this.setData({
  15. animMaskData: animation.export(),
  16. });
  17. },
  18. createMaskHideAnim() {
  19. this.maskAnim.opacity(0).step();
  20. this.setData({
  21. animMaskData: this.maskAnim.export(),
  22. });
  23. },
  24. createContentShowAnim() {
  25. const animation = my.createAnimation({
  26. duration: 200,
  27. timingFunction: 'cubic-bezier(.55, 0, .55, .2)',
  28. });
  29. this.contentAnim = animation;
  30. animation.translateY(0).step();
  31. this.setData({
  32. animContentData: animation.export(),
  33. });
  34. },
  35. createContentHideAnim() {
  36. this.contentAnim.translateY('100%').step();
  37. this.setData({
  38. animContentData: this.contentAnim.export(),
  39. });
  40. },
  41. },
  42. };