Jump to content
Search Community

Yoyo

Guest newdevide
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

Guest newdevide

Hey guys,

I'm doing something like this, so the main objective is to start a repeating animation when a button is clicked

 

 

function yoyoContact(){

var cYoyo = new TimelineMax({repeat:-1});

cYoyo.append([

TweenMax.to($("cLogo"), 1, {css:{scale:1}}),

TweenMax.to($("cBrand"), 1, {css:{scale:1}})

])

cYoyo.append([

TweenMax.to($("cLogo"), 1, {css:{scale:0.25}, delay:3}),

TweenMax.to($("cBrand"), 1, {css:{scale:0.25}, delay:3})

])

}

 

i made a button, and when its clicked it called the yoyoContact function. I must have done something wrong, coz it didn't work.

Any suggestions?

Link to comment
Share on other sites

Hi,

 

the part of the code that you displayed looks good to me.

Are you certain the function is being called?

try adding

 

console.log("yoyoContact");

 

inside yoyoContact()

 

Be sure to open your browser's javascript console when testing.

Link to comment
Share on other sites

And by the way, I assume your objects start at a normal scale (1), and if that's true then the way you wrote your code would make things basically stay at 1 for 4 seconds and then animate to 0.25 and back to 1, wait for 8 seconds, rinse and repeat. So I'm wondering if you are thinking it's not working because you're not waiting 4 seconds to see the animation.

Link to comment
Share on other sites

Guest newdevide

So sorry, i've been out with a bad fever and havent been active here for the last 5 days.

So to cut things short. I've figured out the probs. So i forgot te set my style (not MY STYLE, but the css style) position to absolute. Now everything works fine after i set it to posistion:absolute.

 

It brings me to another question. Is it only when we set the style position to absolute that we can animate the div?

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...