This repository has been archived by the owner on Dec 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSnowEffect.js
128 lines (118 loc) · 15.1 KB
/
SnowEffect.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**
* @file Snow effect library for providing showing snow effect on screen.
* @author Astro <[email protected]>
* @version 1.0
* @license Apache-2.0
*/
/** @namespace global */
($ => {
"use strict";
const Bitmap_ = android.graphics.Bitmap,
BitmapFactory_ = android.graphics.BitmapFactory,
Base64_ = android.util.Base64,
Gravity_ = android.view.Gravity,
ImageView_ = android.widget.ImageView,
PopupWindow_ = android.widget.PopupWindow,
MainActivity_ = com.mojang.minecraftpe.MainActivity,
Thread_ = java.lang.Thread,
CONTEXT = MainActivity_.currentMainActivity.get(),
DP = CONTEXT.getResources().getDisplayMetrics().density,
DEVICE_WIDTH = CONTEXT.getScreenWidth(),
DEVICE_HEIGHT = CONTEXT.getScreenHeight(),
SCREEN = CONTEXT.getWindow().getDecorView();
/**
* Class representing a snow effect.
* @since 2016-12-20
* @class
* @memberOf global
*/
function SnowEffect() {
this._isRunning = false;
}
/**
* Finishes the snow effect.
* @since 2016-12-20
*/
SnowEffect.prototype.finish = function () {
this._isRunning = false;
};
/**
* Starts a snow effect.
* @since 2016-12-20
*/
SnowEffect.prototype.start = function () {
let thiz = this;
thiz._isRunning = true;
new Thread_({
run() {
while (thiz._isRunning) {
let particle = new SnowParticle();
particle.create();
Thread_.sleep(500);
}
}
}).start();
};
/**
* Class representing a snow particle.
* @since 2016-12-20
* @class
*/
function SnowParticle() {
this._isShowing = false;
}
/**
* Snow particle resource bitmap.
* @type {android.graphics.Bitmap}
* @see {@link https://thenounproject.com/term/snow/64/}
*/
SnowParticle.RESOURCE = (() => {
let bytes = Base64_.decode("iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqg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fWzmgmcRb4KFWWGsglkCvWlxTagOd+vA5cS3yGyPfRAKw5Psflggz/2xRbIeHt7V7NUvAgtZ7A9tYeyDEJ3/u+xiWDeaEL3YsahezP1zG9m1PC5Feiyd64SphCRvP70E5Hx0jYPicjmdZxnYxH5gxSL5SJyo4isX+M16SwiZ4rIx+083yMisk0en7M8CwQRaRSRc0Rk8UpuymwRGSIiDTUeu5uIXCAin0lx+UREzhWRLjVeo54icq0JbmVMFpH98/yM5V0glZ8+IvJci7fj1SLSvY7jHSki70h5mCUiB9VxvfqLyOMtjveeiAyzF1iun61YZaDTWrU5GQ2TnljnsZ7O2LJtCMYCh9a5gHEwGoZ0Ndmre1gTRbIJXY7WsXAiTWdNZGN9FctxfJnXcRwXiOO4QDLBvWjcVr3cBjzol9MFUhQq+QvHoBHO9fI3NKx+b7Jpmu0CcdrFbNR0YBfguRSO/xQa/jIUzclxXCC54DO0HkUf1HQgTX+v5ahXcBNwCRk0XnOBFJOfUr0xhdgcowmtuBXShWMBcAH1Ga/N8tvuAmkvz6KJ/sOA99vx90+iWYXDiOszWzFe2wX1DGgP42yOdIbfdhdItcOXSo9wJSsPr5+B5ljsi2bwZYUXgMGo1c3bbQhj/5TmSC6QkvApmkvSsqzzR6iLSH/UtSWLAW2CWt30RfNnKrFRT6C11V0Y7aCjX4KqxuhDUD+w19FqU3lgMXA5un+yZRVDL8cFUhPP57Tdc+3H8SGW47hAHMcF4jguEMdxgTiOC8RxXCCO4wJxHMcF4jguEMdxgTiOC8RxXCCO4wJxHBeI47hAHMcF4iTCG8CyOj6/lHLUnHeBlJT70PoZL9fw2RfQGov3+WV0gRSZycCuwLm0z+htIVrGeTBaqdYJSJEqTOWR3sDNtF7N6nFgOMl4+jreg+SOmagJ9XDUXqjCR8AJwIEuDu9BHGVT4DobUp2BO5Bkgv8fANxn3fYlX3kgAAAAAElFTkSuQmCC", 0);
return BitmapFactory_.decodeByteArray(bytes, 0, bytes.length);
})();
/**
* Creates a snow particle.
* @since 2016-12-20
*/
SnowParticle.prototype.create = function () {
let thiz = this,
size = Math.floor(Math.random() * 10 + 5) * DP,
x = Math.floor(Math.random() * DEVICE_WIDTH - DEVICE_WIDTH / 2),
particle = new ImageView_(CONTEXT);
CONTEXT.runOnUiThread({
run() {
particle.setImageBitmap(Bitmap_.createScaledBitmap(SnowParticle.RESOURCE, DP * size, DP * size, false));
thiz._window = new PopupWindow_(particle, -2, -2);
thiz._window.showAtLocation(SCREEN, Gravity_.TOP, x, 0);
}
});
thiz._isShowing = true;
new Thread_({
run() {
let y = 5;
while (thiz._isShowing && y < DEVICE_HEIGHT) {
CONTEXT.runOnUiThread({
run() {
thiz._window.update(x, y, -2, -2);
}
});
Thread_.sleep(50);
y += 5;
}
if (thiz._isShowing) {
thiz._isShowing = false;
if (thiz._window instanceof PopupWindow_) {
CONTEXT.runOnUiThread({
run() {
thiz._window.dismiss();
thiz._window = null;
}
});
}
}
}
}).start();
};
$.SnowEffect = SnowEffect;
$.SnowParticle = SnowParticle;
})(this);