Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const JAVA_ANIMATOR = android.animation.ValueAnimator;
- const JAVA_HANDLER = android.os.Handler;
- const LOOPER_THREAD = android.os.Looper;
- const JAVA_HANDLER_THREAD = new JAVA_HANDLER(LOOPER_THREAD.getMainLooper());
- const createAnim = function(_values, _duration, _updateFunc){
- var animation = JAVA_ANIMATOR.ofInt(_values);
- animation.setDuration(_duration);
- if(_updateFunc)animation.addUpdateListener({
- onAnimationUpdate : function(updatedAnim){
- _updateFunc(updatedAnim.getAnimatedValue(), updatedAnim);
- }
- });
- JAVA_HANDLER_THREAD.post({
- run: function(){
- animation.start();
- }
- })
- return animation;
- }
- var textElem;
- var textElement = {
- type: "text",
- x: 400,
- y: 550,
- text: 'Test text',
- z: 10,
- font: {
- color: android.graphics.Color.argb(255, 255, 255, 255),
- size: 50,
- shadow: 0
- }
- }
- function startAnim(){
- //textElem = testUi_Screen2.getContentProvider().elementMap.get("text");
- createAnim([0,255], 500, function(value){
- textElement.font.color = android.graphics.Color.argb(value, 255, 255, 255);
- //textElem.descriptionWatcher.refresh();
- })
- }
- var testUi_Screen2 = new UI.Window({
- location: { x: 300, y: 60, width: 300, height: 300 }, elements: {
- "element1": {
- type: "button", x: 0, y: 0, scale: 250/20, bitmap: "close_button",
- onTouchEvent: function (a, event) {
- if(event.type != 'CLICK')return;
- startAnim();
- }
- },
- text: textElement
- },
- drawing: [{type: 'color', color: android.graphics.Color.TRANSPARENT}]
- });
- var container_2 = new UI.Container();
- testUi_Screen2.setAsGameOverlay(true);
- container_2.openAs(testUi_Screen2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement