WIP
This commit is contained in:
parent
2ae578d97d
commit
7a560ed793
@ -142,7 +142,7 @@ $(async function () {
|
|||||||
randRange(0,canvas.height),
|
randRange(0,canvas.height),
|
||||||
0,0,0,0);
|
0,0,0,0);
|
||||||
this.sete = emote ? emote:null
|
this.sete = emote ? emote:null
|
||||||
this.emote = emote || randEmote(this.sete)
|
this.emote = Array.isArray(emote)? randEmote(this.sete) : emote
|
||||||
this.time = 0;
|
this.time = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,9 +157,13 @@ $(async function () {
|
|||||||
|
|
||||||
draw(){
|
draw(){
|
||||||
ctx.globalAlpha = tWave(this.time);
|
ctx.globalAlpha = tWave(this.time);
|
||||||
if(img_map[this.emote])
|
if(img_map[this.emote]){
|
||||||
ctx.drawImage(img_map[this.emote], this.x, this.y,
|
let img = img_map[this.emote]
|
||||||
sWave(this.time,this.size), sWave(this.time,this.size));
|
let factor = img.naturalWidth / img.naturalHeight;
|
||||||
|
ctx.drawImage(img, this.x, this.y,
|
||||||
|
sWave(this.time,this.size*factor), sWave(this.time,this.size));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update(tick){
|
update(tick){
|
||||||
@ -185,9 +189,12 @@ $(async function () {
|
|||||||
|
|
||||||
draw(){
|
draw(){
|
||||||
ctx.globalAlpha = tWave(this.time);
|
ctx.globalAlpha = tWave(this.time);
|
||||||
if(img_map[this.emote])
|
if(img_map[this.emote]){
|
||||||
ctx.drawImage(img_map[this.emote], this.x, this.y,
|
let img = img_map[this.emote]
|
||||||
this.size, this.size);
|
let factor = img.naturalWidth / img.naturalHeight;
|
||||||
|
ctx.drawImage(img, this.x, this.y,
|
||||||
|
this.size*factor, this.size);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,6 +344,7 @@ $(async function () {
|
|||||||
|
|
||||||
main(0);
|
main(0);
|
||||||
|
|
||||||
|
|
||||||
const handleEmoteData = async (d) =>{
|
const handleEmoteData = async (d) =>{
|
||||||
let te = d.twitch, ce = d.custom.map(e=>e.replace(/\s/g, '')).filter(e=> img_map[e]);
|
let te = d.twitch, ce = d.custom.map(e=>e.replace(/\s/g, '')).filter(e=> img_map[e]);
|
||||||
if(!te || te.length == 0){
|
if(!te || te.length == 0){
|
||||||
@ -360,7 +368,8 @@ $(async function () {
|
|||||||
console.log(message.eventType, message.data)
|
console.log(message.eventType, message.data)
|
||||||
let emote = await handleEmoteData(message.data)
|
let emote = await handleEmoteData(message.data)
|
||||||
if(message.eventType == 'bounce') {
|
if(message.eventType == 'bounce') {
|
||||||
createParticule(BounceP, emote, {}, {})
|
for(let em of emote)
|
||||||
|
createParticule(BounceP, em, {}, {})
|
||||||
}else if(message.eventType == 'rain') {
|
}else if(message.eventType == 'rain') {
|
||||||
genRain(emote)
|
genRain(emote)
|
||||||
}else if(message.eventType == 'firework') {
|
}else if(message.eventType == 'firework') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user