Animate when boosting (puffing up)

This commit is contained in:
Jason Zimdars
2024-08-22 18:24:43 -05:00
parent 174779cdb9
commit 73f7ddca36
8 changed files with 101 additions and 24 deletions
@@ -0,0 +1,17 @@
import { Controller } from "@hotwired/stimulus"
import { nextFrame } from "helpers/timing_helpers"
export default class extends Controller {
static classes = [ "play" ]
async play() {
await nextFrame()
this.element.classList.remove(this.playClass)
this.#forceReflow()
this.element.classList.add(this.playClass)
}
#forceReflow() {
this.element.offsetWidth
}
}