animation.js 1009 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. Page({
  2. data: {
  3. list: [{
  4. name: 'fade',
  5. color: 'primary'
  6. },
  7. {
  8. name: 'scale-up',
  9. color: 'success'
  10. },
  11. {
  12. name: 'scale-down',
  13. color: 'warning'
  14. },
  15. {
  16. name: 'slide-top',
  17. color: 'danger'
  18. }, {
  19. name: 'slide-bottom',
  20. color: 'primary'
  21. },
  22. {
  23. name: 'slide-left',
  24. color: 'success'
  25. },
  26. {
  27. name: 'slide-right',
  28. color: 'warning'
  29. },
  30. {
  31. name: 'shake',
  32. color: 'danger'
  33. }
  34. ],
  35. toggleDelay: false
  36. },
  37. toggle: function (e) {
  38. console.log(e);
  39. var anmiaton = e.currentTarget.dataset.class;
  40. var that = this;
  41. that.setData({
  42. animation: anmiaton
  43. })
  44. setTimeout(function () {
  45. that.setData({
  46. animation: ''
  47. })
  48. }, 1000)
  49. },
  50. toggleDelay: function () {
  51. var that = this;
  52. that.setData({
  53. toggleDelay: true
  54. })
  55. setTimeout(function () {
  56. that.setData({
  57. toggleDelay: false
  58. })
  59. }, 1000)
  60. }
  61. })