I need to incorporate the following code in a class I’m working on, so it need it to be like this.translate()...
Instead of the current syntax. How would i do that?
Current syntax:
export default class Tail {
constructor() {
//array of images
this.tail = [...this.el.querySelectorAll('img')]
//length
this.tailCount = this.tail.length
}
this.translate() {
//to be here.
}
}
let translate = [...new Array(this.tailCount)].map(() => ({
// i wish this funtionality incorporated into my `this.translate()`
previous: {
x: 0,
y: 0
},
current: {
x: 0,
y: 0
},
amt: position => 0.10 + 0.05 * position
}))