Jump to content
Search Community

Banner Tweenmax troubles

LarsFinley test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

So, I'm totally new here and probably haven't figured out the search option well enough so please don't kill me

 

Well I have a banner image that is 1800px wide 200px tall. I want it to scroll right to left through a container that is 600px wide by 200px tall. I also want to to repeat when it finishes its path through the container. I have it to the point where it sliding in and getting to the end of the 600px wide container and then it restarts at the beginning. 

 

thanks for your help,

 

Complete Newbie.

 

 

also this is in React.js, dont know if that matters.

 

 

here is my code....

 

The id="pic1" is referring to the picture in my css file

 

<div className="cd-scrolling-bg cd-color-2">
<div className="jumbotron">
<div className="row">
<div className="col-md-6">
<h2> A brief personal History </h2>
</div>
<div id="pic1" className="col-md-6">
</div>
</div>
</div>
</div>
 
this is my TweenMax script...
 
<script>
    TweenMax.staggerFrom(['#pic1'], 8, {ease: Power0.easeInOut, opacity: 1, x: 1500, repeat: -1}, .5);
</script>
 
and here is the pic1 css...
 
#pic1 {
  display: inline-flex;
  overflow: hidden;
  position: center;
  height: 200px;
  background-image: url('./picture/pic1.jpg');
}

 

Link to comment
Share on other sites

Hi @LarsFinley

 

Well React matters, but forget that for a moment because what you're doing looks pretty vanilla. However, I'm not sure what you're having trouble with. Are you trying to do something like this?

See the Pen 8ec75ed344d36f51f0d37a9a42d3d3ba?editors=0010 by osublake (@osublake) on CodePen

 

If you not, can you make a CodePen so we can get a better idea of what's going on? 

  • Like 4
Link to comment
Share on other sites

Thanks for your help OSUblake! I ended up watching some tutorials and hacked it all together. Here is my final solution..

 

var tl = new TimelineMax({ paused: true, repeat: -1 });
 
tl.fromTo("#pic1", 30, { ease: Power0.easeNone, x: -300}, { ease: Power0.easeNone, x: -2200});
 
$('.jumbocolor').mouseenter(function() {
  tl.play();
});
 
$('.jumbocolor').mouseleave(function() {
  tl.stop();
});
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...