import { Animation } from "./animation" ; import { ANIME , EASE_TYPE } from "../cubicons/constants" ; import { FADE_TYPES } from "../cubicons/constants" ; /**
 * Fade in a cubicon on the screen.
 */ export class FadeIn extends Animation { constructor ( params ) { super ( { cubicon : params . cubicon , duration : params . duration ?? ANIME . FADEIN , ease : params . ease , } ) ; } play ( sleepTime ) { this . fadeIn ( this . cubicon , sleepTime ) ; } private fadeIn ( cubicon , sleepTime ) { if ( cubicon . cubType === "geometry" ) { this . geometryFadeIn ( sleepTime ) ; } else { if ( cubicon . cubType === "math-text" ) this . texFadeIn ( sleepTime ) ; } } private geometryFadeIn ( sleepTime ) { this . cubicon . def_cubiconBase . style ( "opacity" , 0 ) ; this . cubicon . def_cubiconBase . transition ( ) . ease ( this . ease ) . delay ( this . cubicon . elapsedTime + sleepTime ) . duration ( this . duration ) . style ( "stroke-opacity" , 1 ) . style ( "opacity" , 1 ) . style ( "fill" , this . cubicon . fillColor ) . style ( "fill-opacity" , this . cubicon . fillOpacity ) ; this . cubicon . elapsedTime += this . duration + sleepTime ; } private texFadeIn ( sleepTime ) { this . cubicon . def_cubiconBase . attr ( "opacity" , 0 ) ; this . cubicon . def_cubiconBase . transition ( ) . ease ( this . ease ) . delay ( this . cubicon . elapsedTime + sleepTime ) . duration ( this . duration ) . attr ( "stroke-opacity" , 1 ) . attr ( "opacity" , 1 ) ; this . cubicon . elapsedTime += this . duration + sleepTime ; } }