Hi all,
like the topic already mentions do I have a problem with stuttering animations inside my TimelineMax animation and it would be really great, if somebody of you could help me. I'm currently developing a system for our company in which images and videos of our work can be uploaded/selected with the help of a CMS. These media should be animated afterwards, so that it looks like a dynamic generated showreel. So I used PHP to dynamically generate the JavaScript code and basically it works, but as you can probably see in the Codepen or in the demo, especially in Chrome the animations are stuttering a lot (depending on your computer/device). I have to say that I'm new to Greensock and also not the most experienced developer, so I would appreciate every advice of you. Regarding my code I guess there's a lot of potential for optimization. Especially the way of adding the subtimelines to the maintimeline and calling the functions of the subtimeline is probably wrong. For example:
var mainTimeline = new TimelineMax({repeat:-1});
mainTimeline.add(websiteTimeline(website));
function websiteTimeline(website) {
MorphSVGPlugin.convertToPath("circle, rect, ellipse, line, polygon, polyline");
// Create sub timeline
var timeline = new TimelineMax();
// Add tweens to sub timeline
timeline.call(morphToPhone);
function morphToPhone() {
TweenMax.to("#bezel-macbook", 0.2, {morphSVG:"#bezel-phone"});
TweenMax.to("#camera-macbook", 0.2, {morphSVG:"#camera-phone"});
TweenMax.to("#screen-macbook", 0.2, {morphSVG:"#screen-phone"});
TweenMax.to("#shape-macbook", 0.2, {morphSVG:"#lock-phone", css:{opacity:0}});
TweenMax.to("#line-macbook", 0.2, {morphSVG:"#speaker-phone", css:{opacity:0}});
TweenMax.to("#touchpad-macbook", 0.2, {morphSVG:"#lock-phone"});
}
}
I also already read about the performance differences between JavaScript and CSS, so my next step would be to use more pure CSS and less TweenMax animations, but I wanted first ask you guys, if you have some better advices for me. I hope anyone of you can help me. Here again the links to my Codepen and demo...
Codepen: http://codepen.io/mathis-krueper/pen/ZeQEzZ
Demo: http://mathis-krueper.de/captain/references/ Thanks in advance!