index.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. var sceneReadyBehavior = require('../../behavior-scene/scene-ready');
  2. var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML;
  3. var xmlCode = ``;
  4. Page({
  5. behaviors:[sceneReadyBehavior],
  6. data: {
  7. xmlCode: '',
  8. type: 0,
  9. blurRadius: 16,
  10. bloomRadius: 16,
  11. bloomIntensity: 2,
  12. bloomThreshold: 0.5,
  13. vignetteIntensity: 1,
  14. vignetteSmoothness: 2,
  15. vignetteRoundness: 1,
  16. fxaaEnabled: false
  17. },
  18. handleProgress: function({detail}) {
  19. this.setData({progressInfo: `${~~(detail.progress * 100)} %\n\n${detail.asset.assetId}(${detail.asset.type}): ${detail.asset.src}`});
  20. },
  21. handleLoaded: function({detail}) {
  22. this.setData({loaded: true});
  23. },
  24. changeType(e) {
  25. const type = e.detail.value;
  26. if (type === "blur") {
  27. this.setData({
  28. type: 0
  29. });
  30. } else if (type === "bloom") {
  31. this.setData({
  32. type: 1
  33. });
  34. } else if (type === "vignette") {
  35. this.setData({
  36. type: 2
  37. });
  38. } else if (type === "fxaa") {
  39. this.setData({
  40. type: 3
  41. });
  42. }
  43. },
  44. changeBlurRadius(e) {
  45. this.setData({
  46. blurRadius: e.detail.value
  47. });
  48. },
  49. changeBloomRadius(e) {
  50. this.setData({
  51. bloomRadius: e.detail.value
  52. });
  53. },
  54. changeBloomIntensity(e) {
  55. this.setData({
  56. bloomIntensity: e.detail.value
  57. });
  58. },
  59. changeBloomThreshold(e) {
  60. this.setData({
  61. bloomThreshold: e.detail.value
  62. });
  63. },
  64. changeVignetteIntensity(e) {
  65. this.setData({
  66. vignetteIntensity: e.detail.value
  67. });
  68. },
  69. changeVignetteSmoothness(e) {
  70. this.setData({
  71. vignetteSmoothness: e.detail.value
  72. });
  73. },
  74. changeVignetteRoundness(e) {
  75. this.setData({
  76. vignetteRoundness: e.detail.value
  77. });
  78. },
  79. switchFXAA(e) {
  80. this.setData({
  81. fxaaEnabled: !this.data.fxaaEnabled
  82. });
  83. }
  84. });