Created
February 19, 2020 18:59
-
-
Save pigeonfresh/bab76890201c00c97f6352a0708f9a3f to your computer and use it in GitHub Desktop.
Default transitions for Muban
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { MubanTransitionController, IMubanTransitionMixin } from 'muban-transition-component'; | |
import { TimelineMax } from 'gsap'; | |
import C02TitleAndText from './C02TitleAndText'; | |
import { verticalFadeIn } from '../../../util/transition-helpers'; | |
class C02TitleAndTextTransitionController extends MubanTransitionController { | |
protected setupTransitionInTimeline( | |
timeline: TimelineMax, | |
parent: C02TitleAndText, | |
id: string, | |
): void { | |
const transitionItems = parent.getElements('[data-transition-item]'); | |
timeline.add(verticalFadeIn(transitionItems)); | |
} | |
protected setupTransitionOutTimeline( | |
timeline: TimelineMax, | |
parent: C02TitleAndText, | |
id: string, | |
): void {} | |
protected setupLoopingAnimationTimeline( | |
timeline: TimelineMax, | |
parent: C02TitleAndText, | |
id: string, | |
): void {} | |
} | |
export default C02TitleAndTextTransitionController; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TweenMax, Power2 } from 'gsap'; | |
export const verticalFadeIn = (items: Array<HTMLElement>): Array<TweenMax> => { | |
return TweenMax.staggerFromTo( | |
items, | |
1, | |
{ | |
y: 20, | |
autoAlpha: 0, | |
}, | |
{ | |
y: 0, | |
autoAlpha: 1, | |
clearProps: 'visibility, opacity, transform', | |
ease: Power2.easeOut, | |
}, | |
0.2, | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment