index.wxml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <xr-demo-viewer
  2. title="透明画布"
  3. intro="使用透明画布能力,透出背景,背景的waifu是CSS写的。"
  4. code="{{xmlCode}}"
  5. >
  6. <xr-basic-alpha
  7. disable-scroll
  8. id="main-frame"
  9. width="{{renderWidth}}"
  10. height="{{renderHeight}}"
  11. style="width:{{width}}px;height:{{height}}px;top:{{top}}px;left:{{left}}px;display:block;background-image: url(https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/waifu.png);background-size: cover;background-position-x: center;"
  12. clearColor="{{clearR / 100}} {{clearG / 100}} {{clearB / 100}} {{clearA / 100}}"
  13. cubeAlpha="{{cubeAlpha / 100}}"
  14. sphereAlpha="{{sphereAlpha / 100}}"
  15. />
  16. <view style="margin-top: 1rem;"></view>
  17. <view class="form-entry">
  18. <view class="form-entry-title">清屏颜色(红色)</view>
  19. <slider bindchange="changeClearR" value="{{clearR}}"></slider>
  20. </view>
  21. <view class="form-entry">
  22. <view class="form-entry-title">清屏颜色(绿色)</view>
  23. <slider bindchange="changeClearG" value="{{clearG}}"></slider>
  24. </view>
  25. <view class="form-entry">
  26. <view class="form-entry-title">清屏颜色(蓝色)</view>
  27. <slider bindchange="changeClearB" value="{{clearB}}"></slider>
  28. </view>
  29. <view class="form-entry">
  30. <view class="form-entry-title">清屏颜色(透明度)</view>
  31. <slider bindchange="changeClearA" value="{{clearA}}"></slider>
  32. </view>
  33. <view class="form-entry">
  34. <view class="form-entry-title">立方体透明度</view>
  35. <slider bindchange="changeCubeAlpha" value="{{cubeAlpha}}"></slider>
  36. </view>
  37. <view class="form-entry">
  38. <view class="form-entry-title">球透明度</view>
  39. <slider bindchange="changeSphereAlpha" value="{{sphereAlpha}}"></slider>
  40. </view>
  41. </xr-demo-viewer>