Forum Discussion

MathNotermans-9's avatar
MathNotermans-9
Community Member
3 years ago

How to use GSAP for animation in Storyline

As i get this question quit often, i am making a online tester for Gsap animation in Storyline. First step is scaling an image. And defining where you want to scale it from. This transformation point can be set by Gsap and thus change the effect of your animation completely.

Here you can see how this works. To be continued.

https://360.articulate.com/review/content/8b6932db-b253-4e60-b0df-e7569a2cf0ea/review

  • Recently someone asked me whether its possible to trigger elements on SlideLayers with Javascript from the main layer. In fact thats easy with Javascript as the SlideLayers are treated as separate DIVs, nothing more , nothing less. So the selector(s) you use on the main timeline will also work on SlideLayers... if they are visible ofcourse.

    Here you can see the sample i made for that.
    https://360.articulate.com/review/content/41f9e131-b5ba-4bef-8656-d57cd1d6f526/review

    Adding the story of that to this post too.

    What i wanted to make however was a rotating animation of a child around a parent. Earth around the sun... and with that i encountered the issue that the transformation point needed to be outside the bounds of the element....

    to be continued...

  • JordanBest's avatar
    JordanBest
    Community Member

    Hi Math, I'm enjoying your posts regarding GSAP. I've been messing around quite a bit with them and would love to know if you've implemented some of the other plugins like Pixi or MorphSVG? If you have, I'm wondering if you could share how you get those to work in Storyline? Do you load them locally with JavaScript or is there another way? Thank you!

  • Hello, could we use it to make a webObject rotate ? (I think of a 3d model for example)

    Thank you for all your tips !

    • TilburgTeacherE's avatar
      TilburgTeacherE
      Community Member

      For sure... the biggest issue is getting a selector for the WebObject. If you have that...you can simply use GSAP to rotate it.

      If you however mean control animation inside a WebObject... so the html in it..from Storyline..well thats possible too, but what more complex.

      • AyseSahin-3327f's avatar
        AyseSahin-3327f
        Community Member

        Thank you Math, it's really awesome ! 

        You know, what I would like is to manipulate a 3d object by sliding the object (with gesture or mouse).

        I am into interactive module atm (like everybody ?).

        Thank you for your help ! 

  • MerveSatmaz's avatar
    MerveSatmaz
    Community Member

    Thanks, Math. I have a question, I use  Xpercent 'vw' values to get the x and y positions to work correctly when the screen size changes when using gsap and it works but there is some degradation when the user changes the window size with the course open. I saw that you had the same problem in the example you shared. Do you have a solution for this?

    • MathNotermans-9's avatar
      MathNotermans-9
      Community Member

      Hi Merve, i am not sure which example you are referring to... and what degradation.

      If its GSAP related im quite sure you find a solution on their forum...or make a sample codepen on their forum showing the issue and im 100% sure either Jack or one of the other GSAP heroes onthere will quickly help and solve it.

      If its HTML related or Storyline/Articulate related...well this forum is your only chance :-)
      Add a sample showing it clearly and i will help.

      Kind regards,
      Math

      • MerveSatmaz's avatar
        MerveSatmaz
        Community Member

        What I want to tell is actually as in the image below. This kind of corruption happens when I change the window size while the file is open.

  • GSAP (GreenSock Animation Platform) is a powerful JavaScript library for creating high-performance animations. Here are the steps to use GSAP for animation in Storyline:

    1. Open the Storyline project and create a new slide where you want to add the animation.

    2. Click on the "Insert" tab in the Storyline ribbon and select "Web Object."

    3. In the "Web Object" dialog box, enter the URL for the HTML file that contains your GSAP animation code. You can also choose to display the HTML file in a new browser window or within the Storyline slide.

    4. Click on "OK" to insert the web object into your Storyline slide.

    5. Open the HTML file in a text editor and add the necessary GSAP animation code. For example, you can use the TweenMax library to animate objects on the screen.

    6. Save the HTML file and preview the Storyline slide to see the animation in action.

    Note that the exact implementation of GSAP in Storyline may vary depending on your specific project and animation requirements. However, these basic steps should give you a starting point for integrating GSAP into your Storyline project.

    • MathNotermans-9's avatar
      MathNotermans-9
      Community Member

      Comeon David, dont dump generic info thats incorrect too.
      GSAP is included in Storyline360 and you can use it right of the bat with simple JS code i show abudantly.

      • DanLidholm-48cd's avatar
        DanLidholm-48cd
        Community Member

        Hi Math,

        I've been reading through your posts about GSAP and it looks great. I tried some of them and it looks really nice. Thanks for all the info.

        However, I have problem with responsiveness and I cannot find a solution. Is it possible to use an object, like a rectangle to limit the playground for the animation to just take place inside that box? Now, I am using vw & vh but as soon as I change the size of the browser window the animation ends up in the wrong place.

        Hope you can help me.

  • Hi Math,

    I'm super new to javascript, but am trying to learn a little :-) Hope you don't mind if I ask probably an incredibly novice question. 

    I want to have a 3 buttons on a screen ... and if you hover over one it grows and bounces just a little bit. 

    For the trigger I was just using When user hovers over execute JavaScript

    This is the Javascript I was trying to make work


    //Reference the object
    var theObject1 = document.querySelectorAll("[data-acc-text='bounceMe']");

    //Animate in GSAP
    gsap.to(theObject1,{scale:1.05,ease:bounce.out})

    bounceMe is the name I gave the button in the Accessibility panel

    Any chance you coud tell me what I did wrong? I'd be greatful to just get something simple to work..lol! 

    David

    • JordanBest's avatar
      JordanBest
      Community Member

      Hi David,

      It looks like you're missing some quotes: 

       gsap.to(theObject1,{scale:1.15,ease: "bounce.out"});
      • DavidHolzemer-7's avatar
        DavidHolzemer-7
        Community Member

        OMG!!! It actually works :-) Thank you so much Jordan.. Can't wait to do more :-)

  • SuatDilek's avatar
    SuatDilek
    Community Member

    Hi. I want to create a color filling animation inside the svg object on Articulate. The svg element is a letter and I am trying to give the effect that this letter is written when the interaction starts. Do you have any ideas about this?

    • MathNotermans-9's avatar
      MathNotermans-9
      Community Member

      Yes, quite some sample i shared online how to change SVG in Storyline. Do share a sample and i show how.