项目作者: m1ga

项目描述 :
Android BlurView module for Appcelerator Titanium
高级语言: Java
项目地址: git://github.com/m1ga/ti.blurview.git
创建时间: 2020-12-29T20:23:23Z
项目社区:https://github.com/m1ga/ti.blurview

开源协议:Other

下载


Ti.Blurview

Android BlurView module for Appcelerator Titanium

Buy Me A Coke donate button


Simple Android BlurView module for Appcelerator Titanium. Based on: https://github.com/mmin18/RealtimeBlurView

Usage

add

  1. repositories {
  2. maven { url 'https://jcenter.bintray.com/' }
  3. }

to your build.gradle. If you don’t have one you can create it in app/platform/android/build.gradle

  1. <modules>
  2. <module platform="android">ti.blurview</module>
  3. </modules>
  1. <BlurView module="ti.blurview"></BlurView>

or

  1. var blur = require("ti.blurview");
  2. var blurView = blur.createBlurView({});

API

Properties:

  • blurRadius (int)
  • backgroundColor (color)

Example:

  1. var win = Ti.UI.createWindow({
  2. backgroundColor: "#fff"
  3. });
  4. var img = Ti.UI.createImageView({
  5. image: "https://raw.githubusercontent.com/CameraKit/blurkit-android/master/demo/src/main/res/drawable-nodpi/peppers.png",
  6. width: 640,
  7. height: 400,
  8. top: 0
  9. })
  10. var contentView = Ti.UI.createView({
  11. height: 100,
  12. top: 100
  13. })
  14. var lbl = Ti.UI.createLabel({
  15. text: "Content",
  16. color: "#000"
  17. })
  18. var blurview = require("ti.blurview").createBlurView({
  19. blurRadius: 20,
  20. backgroundColor: "#55ffffff"
  21. });
  22. var view_menu = Ti.UI.createView({
  23. bottom: 0,
  24. height: Ti.UI.SIZE,
  25. width: Ti.UI.FILL,
  26. layout: "vertical",
  27. backgroundColor: "#efefef"
  28. })
  29. contentView.add(blurview)
  30. contentView.add(lbl)
  31. win.add([img, contentView, view_menu]);
  32. var lbl1 = Ti.UI.createLabel({
  33. text: "Blur: 2",
  34. color: "#000",
  35. left: 10,
  36. top: 10
  37. });
  38. var slider1 = Ti.UI.createSlider({
  39. min: 1,
  40. max: 20,
  41. left: 20,
  42. right: 20,
  43. value: 20,
  44. bottom: 10
  45. })
  46. view_menu.add([lbl1, slider1]);
  47. slider1.addEventListener("change", function(e) {
  48. blurview.blurRadius = Math.round(e.value);
  49. lbl1.text = "Blur: " + Math.round(e.value);
  50. });
  51. var btn1 = Ti.UI.createButton({
  52. title: "move"
  53. })
  54. view_menu.add(btn1);
  55. btn1.addEventListener("click", function(e) {
  56. contentView.animate({
  57. top: 400,
  58. duration: 4000,
  59. autoreverse: true
  60. })
  61. });
  62. win.open();