Advertisement
Bot213123

foldik loh

Sep 16th, 2020 (edited)
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const JAVA_ANIMATOR = android.animation.ValueAnimator;
  2. const JAVA_HANDLER = android.os.Handler;
  3. const LOOPER_THREAD = android.os.Looper;
  4. const JAVA_HANDLER_THREAD = new JAVA_HANDLER(LOOPER_THREAD.getMainLooper());
  5.  
  6. const createAnim = function(_values, _duration, _updateFunc){
  7.     var animation = JAVA_ANIMATOR.ofInt(_values);
  8.     animation.setDuration(_duration);
  9.     if(_updateFunc)animation.addUpdateListener({
  10.         onAnimationUpdate : function(updatedAnim){
  11.             _updateFunc(updatedAnim.getAnimatedValue(), updatedAnim);
  12.         }
  13.     });
  14.     JAVA_HANDLER_THREAD.post({
  15.         run: function(){
  16.             animation.start();
  17.         }
  18.     })
  19.     return animation;
  20. }
  21.  
  22. var textElem;
  23. var textElement = {
  24.     type: "text",
  25.     x: 400,
  26.     y: 550,
  27.     text: 'Test text',
  28.     z: 10,
  29.     font: {
  30.         color: android.graphics.Color.argb(255, 255, 255, 255),
  31.         size: 50,
  32.         shadow: 0
  33.     }
  34. }
  35.  
  36. function startAnim(){
  37.     //textElem = testUi_Screen2.getContentProvider().elementMap.get("text");
  38.     createAnim([0,255], 500, function(value){
  39.         textElement.font.color = android.graphics.Color.argb(value, 255, 255, 255);
  40.         //textElem.descriptionWatcher.refresh();
  41.     })
  42. }
  43.  
  44. var testUi_Screen2 = new UI.Window({
  45.     location: { x: 300, y: 60, width: 300, height: 300 }, elements: {
  46.         "element1": {
  47.             type: "button", x: 0, y: 0, scale: 250/20, bitmap: "close_button",
  48.             onTouchEvent: function (a, event) {
  49.                 if(event.type != 'CLICK')return;
  50.                 startAnim();
  51.             }
  52.         },
  53.         text: textElement
  54.     },
  55.     drawing: [{type: 'color', color: android.graphics.Color.TRANSPARENT}]
  56. });
  57. var container_2 = new UI.Container();
  58. testUi_Screen2.setAsGameOverlay(true);
  59. container_2.openAs(testUi_Screen2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement