Jump to content
Search Community

How to insert different urls into dynamic banner with GSAP

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

I have simple dynamic javascript banner with GreenSock Animation Platform like this:

var tl = new TimelineMax({repeat:999999999, repeatDelay:3});

    var blurElement = {a:0};

    tl.to(blurElement, 0.1, {a:0, onUpdate:applyBlur, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01})
    tl.from(".bg", 1, {opacity:0, ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01})
    tl.from(".plate", 1, {x:-300,ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01},"-=0.6")
    tl.from(".cupNew", 1, {x:-300,ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01},"-=0.7")
    tl.staggerFrom(".irresistible, .logo, .aromat", 1, {opacity:0, x:-20, ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, 0.4, "-=1")
    tl.staggerTo(".irresistible, .aromat", 1, {x:300,ease:Expo.easeIn, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, 0.4)
    tl.to(".cupNew", 3, {rotation: "-=360_ccw", ease:Expo.easeInOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "-=1.4")
    tl.staggerFrom(".authentic, .taste", 1, {opacity:0, x:-20, ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, 0.4, "-=1.4")
    tl.staggerTo(".authentic, .taste", 1, {x:300,ease:Expo.easeIn, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, 0.4, "+=0.4")
    tl.from(".nepovt", 1, {opacity:0, y:-120,ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01})
    tl.to(".logo", 1, {y:35, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "-=0.7")
    tl.from(".stamp", 1, {opacity:0, scale:0.1, y:-120, x:-100,ease:Expo.easeIn, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "-=1.6")
    tl.to(".stamp, .nepovt, .cupNew, .plate, .logo", 1, {opacity:0, ease:Expo.easeOut}, "+=1.2")
    tl.from(".homeEspresso", 1, {x:300,ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01})
    tl.from(".newOne", 1, {opacity:0, scale:0.1, y:-80, x:-100,ease:Expo.easeIn, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "-=1")
    tl.from(".coffeeMaker", 1, {y:300,ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "-=1.4")
    tl.to(".homeEspresso, .coffeeMaker, .newOne", 1, {opacity:0, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "+=1.4")
    tl.from(".jezveFineli", 1, {x:300,ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01})
    tl.from(".newOneCopy", 1, {opacity:0, scale:0.1, y:-80, x:-100,ease:Expo.easeIn, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "-=1")
    tl.from(".jezve", 1, {y:300,ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "-=1.4")
    tl.to(".jezveFineli, .jezve, .newOneCopy", 1, {opacity:0, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "+=1.4")
    tl.to(blurElement, 1, {a:2, onUpdate:applyBlur, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "-=0.6")
    tl.from(".layer", 1, {opacity:0, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, "-=0.6")
    tl.staggerFrom(".logoCopy, .innovation", 1, {opacity:0, y:-20, ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, 0.3, "-=0.2")
    tl.staggerFrom(".onlyNow, .button", 1, {y:300,ease:Expo.easeOut, force3D:true, autoRound:false, z: 0.1, rotationZ:0.01}, 0.4, "-=0.8");

function applyBlur()
{
	TweenMax.set(['.bg'], {msFilter:"blur(" + blurElement.a + "px)", webkitFilter:"blur(" + blurElement.a + "px)",filter:"blur(" + blurElement.a + "px)"});  
};

function openURL() {
	
	window.open("http://www.example.bg");
	
}

The whole banner is linking to one specific url with javascript function opelURL() and window.open but i wanna make it link to different urls based on the time of the banner. For example from 0-3 sec when click banner link to site1, from 3-6 sec when click on banner to site2 and so on.

 

Thank you in advance :)

 

 

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