You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is it possible to target elements of a child component. or possibly add a child components timeline to the main components timeline and run it in the correct space.
I have a title with a border around it that I want to draw in the bordered lines. This "border" is actually absolute posiitoned spans so I can animate the length and get a drawing border effect. This component will be used in multiple places so I was trying to break it out into its own element for easy reuse.
Now in my main component I would like to access the h1 and all of the spans and animate them. but it doesn't seem to work.
import React, { Component } from 'react';
import GSAP from 'react-gsap-enhancer';
import { TimelineMax, Power2 } from 'gsap';
import FullSection from '../../containers/full-section';
import BorderedTitle from '../../titles/bordered-title';
import SubTitle from '../../titles/sub-title';
import ScrollDown from '../../labels/scroll-down';
class SlideOne extends Component {
componentWillEnter(callback) {
this.addAnimation(this.enterAnimation, {callback: () => this.allowScroll(callback)});
}
enterAnimation({target, options}) {
console.log('transform one will enter');
const title = target.find({name: 'title'});
const titleText = target.findInChildren({name: 'text'});
const subTitle = target.find({name: 'subtitle'});
const tl = new TimelineMax({onComplete: options.callback});
console.log(title);
console.log(titleText);
return tl.to(title, 1, {
autoAlpha: 1,
ease: Power2.easeIn
})
.to(subTitle, 1, {
autoAlpha: 1,
ease: Power2.easeIn
})
.to(titleText, 1, {
color: "red",
ease: Power2.easeIn
});
}
render() {
return (
<FullSection>
<BorderedTitle name="title">transform</BorderedTitle>
</FullSection>
);
}
}
export default GSAP()(SlideOne);
Basically the console log for title shows that it has 5 children but I cannot use title.find({name: "text"});
in order to see animate it.
If this isn't possible my other idea is to setup the animations in the child component and use timeline.add() in order to add those animations but I am really at a loss on how to do that also.
The text was updated successfully, but these errors were encountered:
Is it possible to target elements of a child component. or possibly add a child components timeline to the main components timeline and run it in the correct space.
I have a title with a border around it that I want to draw in the bordered lines. This "border" is actually absolute posiitoned spans so I can animate the length and get a drawing border effect. This component will be used in multiple places so I was trying to break it out into its own element for easy reuse.
Example I have is the following
Now in my main component I would like to access the h1 and all of the spans and animate them. but it doesn't seem to work.
Basically the console log for title shows that it has 5 children but I cannot use
title.find({name: "text"});
in order to see animate it.
If this isn't possible my other idea is to setup the animations in the child component and use timeline.add() in order to add those animations but I am really at a loss on how to do that also.
The text was updated successfully, but these errors were encountered: