You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
663 B
24 lines
663 B
"use strict";
|
|
class Palet extends Anime {
|
|
constructor(element) {
|
|
super(element);
|
|
this.setImage("palet.png", 700, 200);
|
|
this.ecouteurSuivre = (evt) => { this.suivre(evt); };
|
|
}
|
|
animer() {
|
|
window.addEventListener("mousemove", this.ecouteurSuivre);
|
|
}
|
|
figer() {
|
|
window.removeEventListener("mousemove", this.ecouteurSuivre);
|
|
}
|
|
suivre(evt) {
|
|
let nx = evt.clientX - this.getParent().getX() - this.getWidth() / 2;
|
|
if (nx <= this.xmin_)
|
|
nx = this.xmin_;
|
|
if (nx >= this.xmax_)
|
|
nx = this.xmax_;
|
|
console.log(this.xmax_);
|
|
this.setX(nx);
|
|
}
|
|
}
|