+
+ // Sets the center from mouse
+ _setCenterFromMouse(event) {
+
+ this._showCursor();
+ this._targetCenter.x = event.offsetX;
+ this._targetCenter.y = event.offsetY;
+ setTimeout(this._hideCursor.bind(this), this._cursorTimeout);
+ }
+
+ // Binds the wheel event to resize the heart
+ _detectWheel() {
+
+ this.canvas.addEventListener('wheel', this._onWheel.bind(this));
+ }
+
+ // Handle the mouse wheel movement
+ _onWheel(event) {
+
+ if (!this._ticking) {
+ this._ticking = true;
+ window.requestAnimationFrame(this._resizeHeartFromDelta.bind(this, event.deltaY));
+ }
+ }
+
+ // Use delta to resize the heart
+ _resizeHeartFromDelta(delta) {
+
+ let heartSize = this.heartSize + (this._resizeMagnitude * delta);
+
+ if (heartSize > this.maxHeartSize) {
+ heartSize = this.maxHeartSize;
+ }
+
+ if (heartSize < this.minHeartSize) {
+ heartSize = this.minHeartSize;
+ }
+
+ this._targetHeartSize = heartSize;
+ this._ticking = false;
+ }
+
+ // Apply a class to show the cursor.
+ _showCursor() {
+
+ this.canvas.classList.add('mouse-moving');
+ }
+
+ // Remove class to hide the cursor.
+ _hideCursor() {
+
+ this.canvas.classList.remove('mouse-moving');
+ }