Forum Discussion
GSAP 3.5.1 ( latest version ) is now included in Storyline 360
A few months ago i discovered Storyline uses the GSAP Tweening library for all its animation features. Any animation you make in Storyline somehow is triggered by GSAP under the hood of Storyline. Then i noticed that Articulate still was using TweenLite a very old and limited version of GSAP... back from 2014 :-)
Well today i discovered Storyline updated the GSAP libraries and from this day on you can animate your objects with GSAP javascript code.
For example:
Give any object in your Storyline the 'accessibility name' of "myName"
Then add a trigger to call this Javascript:var myElement = document.querySelectorAll("[data-acc-text='myName']");
gsap.to(myElement, {duration: 2,scaleX:2,autoAlpha:0.5, x: "+=500"});
Your Element will move and fade and scale over the x-axis.
Really great news Articulate acted and updated GSAP.
I will check whats possible with the built-in GSAP code and what not and show that here...
- LeeMulvogueCommunity Member
Thanks for that Math. What methodology did you use to find the structure, to track down the SVG to alter?
I'm trying to figure out how far we could push js control in Storyline, for example could trigger equivalents be dynamically added to objects, could functions dynamically read which object triggered a call, that kind of thing. I currently have Animate CC but may well lose that in the future, but I'm guessing any semi-advanced coding will have to be developed outside and brought in as webobjects, trying to work inside Storyline will likely be too much of a headache.
- MathNotermans-9Community Member
Basically i use the Code Inspector in Chrome to figure out the structure of elements and how to select them.
I do think all you mention can be achieved, and possibly without the need of Webobjects. As i do think at points its no fun to use them...but i do agree with you its difficult at times to get it right.
Another way i explore Storyline is by unminifying and changing the default javascript files residing in the Articulate folder. For example i added all GSAP plugins there so i have them always available...and a generic_functions.js in which i added functions i can call anywhere anytime.
Gladly coop in some way and team up to learn from eachother.
You can contact me directly at m.notermans@fontys.nl
Kind regards,
Math
- StefanKhlerCommunity Member
Hi Math,
please forgive the "stupid questions", I'm a total beginner when it comes to javascript/GSAP.
- GSAP only works with imported SVGs, right?
- Is it possible to zoom in/out images using GSAP?
- If I want to learn more about GSAP and how to use it in Storyline: What would you recommend? How should I proceed? What should I look at most? Javascript to begin with?
Many thanks in advance. :-)
- MathNotermans-9Community Member
You can animate any page element with GSAP. Images, shapes, Storyline UI-elements...even create elements from scratch. Anything is possible. Yes, you can zoom in/out of image. scaleX, scaleY or scale will do that. To achieve a zoom-effect you need to keep the 'mask' of an object static... or scale down probably..
Check starting with my posts..
I would love to start a tutorial series to help anyone with GSAP in Storyline...not sure how to post and maintain that on the community though...- OwenHoltSuper Hero
My suggestion:
Record and put them on YouTube. Then create a dedicated "Learning GSAP" thread and as you add tutorials on YouTube, post the links in the thread with a description of what the tutorial covers.
- DanielBerlinCommunity Member
Hi. Now that I made Storyline 3 stand at attention with GSAP yet another question has arisen for me. Sorry if it's annoying...
The command line:
var element2Animate = document.querySelector("[data-acc-text='star']");
for example, uses the text within an object to gain control of it (in the above case ,it's 'star'). But what can I do if I don't want to place any text within the actual object whatsoever? In the SL timeline I can change the 'name' of the object on the leftmost, white part of the timeline but the text that appears in the light blue part of the timeline can only be changed by actually typing text in the object (to the best of my understanding). Without adding any text within the object, is there a way to access the object, I guess, is my question.
I hope my question is clear and not too annoying.
Thanks,
Daniel.
- MathNotermans-9Community Member
Annoying questions dont exist. Any question is good. An answer or lack of that can be annoying ;-) Trying never to do that though. Actually just yesterday got a question about GSAP and Storyline ( esp. SL3 ) on the GSAP forum and planned answering that today. As i however do not have SL3, only Storyline360 ( Can you actually have both on your computer ? ) answering questions about SL3 is a bit of a guessing game for me. Thx to you Daniel, i just yesterday discovered there is quite some difference in SL3 and SL360, first of all the missing of the GSAP 3.5.1 libraries. So if you want to use that, you need to add them first.
Getting back to your question Daniel...
The name in the timeline window is not the 'acc-name'. That name is only intended for Storyline triggers. See the image below.
On the right of it, in the timeline itself you see the actual acc-name. In Storyline360 ( i am not sure if SL3 has that too ) you can right click an element , select 'Accessibility' and a window with the accessibility name pops up. As seen in the image below.The size/pos button on the top gets you to the same window.
In that window you can change the acc-name and use it in your code. Make sure when changing it to press 'Enter' because that inputfield has the tendency to keep unchanged if you donot.
Offcourse you can use the default acc-name, but you need to be sure you have the correct one.Regards,
Math
- DanielBerlinCommunity Member
Hi Math.
Thanks so much for your in-depth explanation. Yes, SL3 does have access to the accessibility name which can be changed in the pop-up, as you explained. Curiously, that doesn't update the accessibility name as it appears in the timeline, but that's a small detail.
The GSAP libraries are easily accessible in SL3 (and they work!) once I figured out (thanks to you) how to add them in, so no problem there.
I've learned so much thanks to you and your great explanations, so thanks again.
D.
- MathNotermans-9Community Member
Do add a description on how to get Gsap working in Storyline3 Daniel. Im sure it benefits someone
- JoanneChenSuper Hero
This is great news. Thanks for sharing, Math.
- StefanKhlerCommunity Member
Thank you so much! :) Is this a good overview about all the possible "features"? https://greensock.com/docs/v3/GSAP
Am I right we can't use GSAP plugins like flip?
- MathNotermans-9Community Member
Flip, MorphSVG and those plugins are not default in GSAP 3. You have to get a Greensock Club account ( i have a Shockingly Green account since years ) and then you get access to all the plugins and can add them to any project. It for sure is worth any penny and i use them on a daily base. Personally love MorphSVG, DrawSVG, ScrollTrigger and MotionPath Plugin. Use those to create quite complex animations and interactivities in Storyline.
PS. GSAP is now at version 3.6 versus the one in Storyline360 is at 3.5.1. Im not sure whether Articulate plans to keep the versions synced and updated. If not you at all times when using plugins need to watch carefully a plugin uses the proper GSAP... as Flip eg. is new with version 3.6 it might not work with the default GSAP library in Storyline360 and you might need to add the uptodate version of GSAP.
- MathNotermans-9Community Member
The plug-ins are not default included in Storyline. You have to add them. You can use them. I have them included in most projects and do use them all the time.
- MathNotermans-9Community Member
Especially the SVG plug-ins i love. Check my posts on them.
- StefanKhlerCommunity Member
Hi Math,
I have been intensively dealing with GSAP in the last few days and have to say: Great solution!
Now I have encountered a problem: When I animate elements e.g. like this:
var tl = gsap.timeline();
var icon= document.querySelectorAll("[data-acc-text='icon']");
tl.to(icon, {repeat: 10, yoyo: true, ease: "power1. inOut", duration:2, repeatDelay: 0.25, scale:1.45 });
Then I have the problem: As soon as I change the screen size form my browser or change the format on the mobile (e.g. to landscape format), the animated elements are suddenly in completely different positions or not visible at all. Is there a way to solve the problem?
- MathNotermans-9Community Member
Yeah that is the position issue Owen mentioned before. Several fixes for that... if you refresh your browser after the change of size...well the positions get updated properly...but it might that thats not what you want.
Some of the other options are...
- using fixed elements in the Storyline for reference positions ( if you check my samples you find solutions for that )
- use vw (=viewportwidth) and/or vh (=viewportheight) for your animations. That is relative and thus can work properly.
- add a eventHandler for the browserchange.. JQuery has resize( ) for that... in Vanilla Javascript something like this works too..var wrapper = document.getElementById('#wrapper');
window.addEventListener("resize", function(){
if(window.innerWidth < 768){
console.log('narrow');
}
else{
console.log('wide');
}
});
I attach a older sample that has some of the functionality needed in it. Not all, but with some puzzling and downloading some of my samples you should be able to figure it out. When time permits i mock up a new fully functional sample. At the moment no time alas.