Использование класса js

121
27 ноября 2019, 16:10

Создаю popUp в js , не получается скрыть его. Подскажите пожалуйста в чем проблема. Класс :

class PopUp {
            constructor(x, y, width, height, self) {
                this.x = x;
                this.y = y;
                this.width = width;
                this.height = height;
                this.self = self;
            }
        get background() {
           var a = this.self.game.add.graphics(this.x, this.y);
                 a.beginFill(0xffffff, 1);
                 a.lineStyle(3, 0X009b97);
                 a.drawRoundedRect(0, 0, this.width, this.height, 20);
                 a.endFill();
                 a.visible = false;
                 return a;
        };
        get topConteiner() {
            const top = this.self.game.add.graphics(this.x, this.y);
                  top.beginFill(757575, 1);
                  top.drawRoundedRect(0, 0, this.width, this.height / 3, 20);
                  top.endFill;
                  top.visible = false;
                  return top;
        };
        get topText() {
            const text = this.self.game.add.text(this.x + (this.width / 2), this.y, "Ви");
                  text.anchor.setTo(0.5, -0.5);
                  text.font = 'Reef';
                  text.fontSize = 25;
                  text.wordWrap = true;
                  text.wordWrapWidth = this.width;
                  text.wordWrapHeight = this.height / 3;
                  text.visible = false;
                  return text;
        }
        get centerConteiner() {
            const center = this.self.game.add.graphics(this.x, this.y + (this.height / 3));
                  center.beginFill(989898, 1);
                  center.drawRoundedRect(0, 0, this.width, this.height / 3, 20);
                  center.endFill;
                  center.visible = false;
                  return center;
        }
         set showFrozen(isReady) {
             this.background.visible = isReady;
             this.topConteiner.visible = isReady;
             this.topText.visible = isReady;
             this.centerConteiner.visible = isReady;
         };
    }

Вызов класса :

var Pop = new PopUp(game.world.centerX / 2, game.world.centerY / 2, 500, 200, this);
            Pop.showFrozen = true;
            setTimeout(function () {
                Pop.showFrozen = false;
            }, 3000)
READ ALSO
CKEDITOR5 wyswig

CKEDITOR5 wyswig

Есть такой wyswig под названием Ckeditor5 https://ckeditorcom/docs/ckeditor5/latest/builds/guides/integration/frameworks/vuejs

73
проблемы с EventListener

проблемы с EventListener

Работает только если открыто несколько оконКак сделать чтобы работало, если открыто одно окно?

114
Переписать код с Jquery на Javascript

Переписать код с Jquery на Javascript

Как перевести код с jQuery на javascript

81
Как работать с svg иконками в React?

Как работать с svg иконками в React?

Сейчас просто вставляю несколько иконок в файл Iconsjs, и импортирую уже где необходимо

116