I'm trying to get to grips with react-scrollmagic and react-gsap and am attempting to achieve a scroll activated opacity fade-in/fade-out when scrolling from one component to the next similar to that seen here however i'm barely making any progress... I can child elements with tween, but cannot extend it onto the component level. Can anyone help me understand the implementation? This is where I am at at the moment:
/*./Components/Test.js */
import React, { Component } from "react";
class Test extends Component {
render() {
return (
<div id={this.props.id}>Component</div>
);
}
}
/* App.js */
import React from 'react';
import { Tween, Timeline } from 'react-gsap';
import { Controller, Scene } from 'react-scrollmagic';
import Test from "./Components/Test";
<div className="App">
<Controller>
<Scene duration={50} triggerElement="#test">
{(progress) => (
<Tween
from={{
css: {
opacity: '1',
},
ease: 'Circ.easeOutExpo',
}}
to={{
css: {
opacity: '0',
},
ease: 'Circ.easeOutExpo',
}}
totalProgress={progress}
paused
>
<Test id='test'/>
</Tween>
)}
</Scene>
</Controller>
</div>
Thanks!