-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpixi.js
41 lines (32 loc) · 1.07 KB
/
pixi.js
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
"use strict";
class DropDownList {
constructor(width, height, colorLine, backgroundColor) {
this.color = colorLine;
this.width = width;
this.height = height;
this.background = backgroundColor;
this.arrayOfOptions = ['item', 'item2', 'item3'];
}
createRect() {
let renderer = PIXI.autoDetectRenderer(this.width, this.height, { antialias: true });
let stage = new PIXI.Container();
let graphics = new PIXI.Graphics();
graphics.interactive = true;
graphics.click = function() {
console.log('click');
};
graphics.lineStyle(3, this.color, 1);
graphics.beginFill(this.background, 1);
graphics.drawRect(170, 50, 160, 50);
graphics.endFill();
document.body.appendChild(renderer.view);
stage.addChild(graphics);
animate();
function animate() {
renderer.render(stage);
requestAnimationFrame( animate );
}
}
}
let rect = new DropDownList(500, 600, 0xFFCC00, 0x99CCFF);
rect.createRect();