Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.finish = () => {
- return new Promise((resolve, reject) => {
- if (!this.$target.length) {
- window.dispatchEvent(new CustomEvent('arts/preloader/end'));
- resolve(true);
- return;
- }
- this.timeline
- .timeScale(0.8) // <--- add this to slow down animation to 80% of the original speed
- // .delay(0.5) // <--- or add this to delay the finishing animation
- .clear()
- .set(this.cursor.follower.outer, {
- attr: {
- transform: ''
- }
- })
- .to(this.cursor.follower.outer, {
- drawSVG: '0% 100%',
- rotate: 0,
- transformOrigin: 'center center',
- ease: 'expo.inOut',
- duration: 2.0
- }, 'start')
- .add([
- gsap.to(this.counter, {
- duration: 2.0,
- val: this.counter.target,
- ease: 'expo.inOut',
- onUpdate: () => {
- const value = parseFloat(this.counter.val).toFixed(0);
- this.$counter.text(this.counter.prefix + value + this.counter.suffix);
- }
- }),
- ], 'start')
- .add([
- this.tweens.followMouse.play(),
- gsap.to(this.cursor.follower.element, {
- width: this.cursor.follower.size.element.width,
- height: this.cursor.follower.size.element.height,
- ease: 'expo.out',
- duration: 1.2
- }),
- gsap.to(this.cursor.follower.inner, {
- attr: this.cursor.follower.size.inner,
- ease: 'expo.out',
- duration: 1.2,
- }),
- gsap.to(this.cursor.follower.outer, {
- attr: this.cursor.follower.size.outer,
- ease: 'expo.out',
- autoAlpha: 0,
- duration: 1.2,
- }),
- ])
- .add([
- gsap.effects.moveCurtain(this.curtain.element, {
- duration: 1.2
- }),
- gsap.to(this.$content, {
- y: -30,
- delay: 0.1,
- duration: 0.8,
- ease: 'power3.inOut',
- }),
- gsap.to(this.$target, {
- delay: 0.2,
- display: 'none',
- duration: 0.8,
- ease: 'power3.inOut',
- })
- ], '-=1.2')
- .set(window.$pageContent, {
- autoAlpha: 1
- })
- .to(this.curtain.element, {
- autoAlpha: 0,
- delay: 0.4,
- duration: 0.3
- })
- .set([this.$target, this.curtain.element], {
- y: '-100%',
- display: 'none',
- })
- .set(this.cursor.element, {
- clearProps: 'top,left',
- x: '-50%',
- y: '-50%'
- })
- .add(() => {
- window.dispatchEvent(new CustomEvent('arts/preloader/end'));
- window.$body.removeClass('cursor-progress');
- this.tweens.followMouse.kill();
- resolve(true);
- }, '-=0.6')
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement