mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-18 21:40:49 +02:00
50.0.0: Distort, Glitch, Aliases, Other stuff
This commit is contained in:
@@ -102,6 +102,25 @@ class Util {
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static distort(ctx, x, y, width, height, amplitude, strideLevel = 4) {
|
||||
const data = ctx.getImageData(x, y, width, height);
|
||||
const temp = ctx.getImageData(x, y, width, height);
|
||||
const stride = width * strideLevel;
|
||||
for (let i = 0; i < width; i++) {
|
||||
for (let j = 0; j < height; j++) {
|
||||
const xs = Math.round(amplitude * Math.sin(2 * Math.PI * 3 * (y / height)));
|
||||
const ys = Math.round(amplitude * Math.cos(2 * Math.PI * 3 * (x / width)));
|
||||
const dest = j * (stride + i) * strideLevel;
|
||||
const src = (j + ys) * (stride + (i + xs)) * strideLevel;
|
||||
data.data[dest] = temp.data[src];
|
||||
data.data[dest + 1] = temp.data[src + 1];
|
||||
data.data[dest + 2] = temp.data[src + 2];
|
||||
}
|
||||
}
|
||||
ctx.putImageData(data, x, y);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
static async verify(channel, user, time = 30000) {
|
||||
const filter = res => {
|
||||
const value = res.content.toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user