Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- addEvent("onNotificationEnd");
- class Notification {
- constructor(id,text,font,r,g,b,x,y) {
- draw = Draw(x,y,text);
- draw.font = font;
- draw.setColor(r,g,b);
- draw.setAlpha(0);
- this.id = id;
- draw.visible = true;
- notificationsTimer(this);
- }
- id = -1;
- draw = -1;
- count = 1;
- }
- function notificationsTimer(n) {
- setTimer(function() {
- if (n.count >= 1 && n.count <= 10) {
- n.draw.setAlpha(25.5 * n.count);
- } else if (n.count >= 50 && n.count <= 60) {
- n.draw.setAlpha(255 - (10 - (60 - n.count)) * 25.5);
- }
- if (n.count == 60) {
- n.draw.visible = false;
- callEvent("onNotificationEnd",n.id);
- }
- local pos = n.draw.getPosition();
- n.draw.setPosition(pos.x,pos.y - 16.6);
- n.count += 1;
- },50,60);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement