File: flashspot.js

package info (click to toggle)
cinnamon 6.4.13-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,304 kB
  • sloc: javascript: 54,298; ansic: 51,499; python: 21,971; xml: 2,803; sh: 96; makefile: 27; perl: 13
file content (45 lines) | stat: -rw-r--r-- 1,175 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-

const Lang = imports.lang;

const Lightbox = imports.ui.lightbox;
const Main = imports.ui.main;
const Tweener = imports.ui.tweener;

const FLASHSPOT_ANIMATION_TIME = 0.4; // seconds

var Flashspot = class Flashspot extends Lightbox.Lightbox {
    constructor(area) {
        super(
            Main.uiGroup,
            {
                inhibitEvents: true,
                width: area.width,
                height: area.height
            }
        );

        this.actor.style_class = 'flashspot';
        this.actor.set_position(area.x, area.y);
        if (area.time)
            this.animation_time = area.time;
        else
            this.animation_time = FLASHSPOT_ANIMATION_TIME;
   }

   fire() {
      this.actor.opacity = 255;
      Tweener.addTween(this.actor,
                      { opacity: 0,
                        time: this.animation_time,
                        transition: 'easeOutQuad',
                        onComplete: Lang.bind(this, this._onFireShowComplete)
                      });
      this.actor.show();
   }

   _onFireShowComplete () {
        this.destroy();
   }
};