Skip to content

Commit

Permalink
chore(ripple): remove animation signal logic
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 509884639
  • Loading branch information
asyncLiz authored and copybara-github committed Feb 15, 2023
1 parent c435a33 commit bda1b20
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions ripple/lib/ripple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {html, LitElement, PropertyValues} from 'lit';
import {property, query, state} from 'lit/decorators.js';
import {classMap} from 'lit/directives/class-map.js';

import {createAnimationSignal, EASING} from '../../motion/animation.js';
import {EASING} from '../../motion/animation.js';

const PRESS_GROW_MS = 450;
const MINIMUM_PRESS_MS = 225;
Expand Down Expand Up @@ -44,8 +44,7 @@ export class Ripple extends LitElement {
private rippleSize = '';
private rippleScale = '';
private initialSize = 0;
private readonly pressAnimationSignal = createAnimationSignal();
private growAnimation: Animation|null = null;
private growAnimation?: Animation;
private delayedEndPressHandle?: number;

beginHover(hoverEvent?: Event) {
Expand Down Expand Up @@ -168,15 +167,14 @@ export class Ripple extends LitElement {
}

private startPressAnimation(positionEvent?: Event|null) {
this.growAnimation?.cancel();
this.determineRippleSize();
const {startPoint, endPoint} =
this.getTranslationCoordinates(positionEvent);
const translateStart = `${startPoint.x}px, ${startPoint.y}px`;
const translateEnd = `${endPoint.x}px, ${endPoint.y}px`;

const signal = this.pressAnimationSignal.start();

const growAnimation = this.mdRoot.animate(
this.growAnimation = this.mdRoot.animate(
{
top: [0, 0],
left: [0, 0],
Expand All @@ -193,17 +191,5 @@ export class Ripple extends LitElement {
easing: EASING.STANDARD,
fill: ANIMATION_FILL
});

growAnimation.addEventListener('finish', () => {
this.pressAnimationSignal.finish();
this.growAnimation = null;
});

signal.addEventListener('abort', () => {
growAnimation.cancel();
this.growAnimation = null;
});

this.growAnimation = growAnimation;
}
}

0 comments on commit bda1b20

Please sign in to comment.