Jump to content
Search Community

Rodrigo last won the day on June 14

Rodrigo had the most liked content!

Rodrigo

Administrators
  • Posts

    6,942
  • Joined

  • Last visited

  • Days Won

    293

Everything posted by Rodrigo

  1. Hi, I remembered that someone else had a similar question some time ago, you can check that post and see if it helps: http://forums.greensock.com/topic/7362-tween-right-to-left-transformorigin-not-working/ The thing is that transform origin only works for transform properties like scale, skew, etc., while width and height are determinated ny the top left corner pc the element. I've created a simple codepen in order to show a simple height growing element and a clip tween revealing the element, you can see it here: http://codepen.io/rhernando/pen/Ekxni Hope this helps, Cheers, Rodrigo.
  2. Hi, Maybe you could try giving the element an absolute position and then give it a bottom:0 property. Finally you could set the height with a TweenLite.set instance and finally tween it to its normal height. Hope this helps, Cheers, Rodrigo.
  3. Hi, Maybe you could try a TweenMax.set instance to center the element before everything else happens. Also you could add an opacity to it as well, like that when the main animation starts everything will be on the right place. Hope this helps, Cheers, Rodrigo.
  4. Hi and welcome to the forums. It's not the easiest thing to do. For the building construction you could try different divs with an absolute position and setting the background position according where they are in the building, then you can set all the heights to zero and then create a timeline that tweens the heights back to normal size, creating a building event. The walking people is a tough one, rather than create an animated gif of the width of the viewport (which will stink up the place if you use fluid layout) with flash with an animation as random as possible will be my best suggestion. Another chance could be to create each walking animation with SVG and then move the SVG object with GSAP but that would require some trial an error until you find the right timing. Unfortunately I'm far from being a canvas or SVG expert, but mainly for the downside you mention, too much kb involved for a "give to me fast!!!" type of world we're living right now. Hope this helps, Cheers, Rodrigo.
  5. Rodrigo

    Noobie needs help!

    Hi The reason for the console log code is to check that everything is on the right place. If not it means that there's a problem with the order of things and probable you should try the window.onload event to create the scrollorama instance. Try that and let me know how it goes. Cheers Rodrigo
  6. Rodrigo

    Tutorials?

    Hi Chrysto, I've checked your tuts keep up the good work!! As for the most difficult GSAP stuff, for me was working with the overwrite manager but not the manager itself, the problem was understanding the modifications of the starting and ending values of the tweens involved in the overwriting and how to create a seamless tween/timeline that could work with overwrite more than once. Also the update and invalidate methods gave me a couple of headaches, but the updated was the worst because I was in diapers in terms of GSAP. Cheers, Rodrigo.
  7. Rodrigo

    Noobie needs help!

    Hi and welcome to the forums. Do you have a live sample that we could look at?. For the behaviour you describe it seems that all your elements have the same offset position (which is what triggers the animation start). In order to check where every element is at when the DOM is ready (I'll presume you're using document.ready) you could add this at your code: var fadeEl = $("#fade-it"), flyEl = $("#fly-it"), spinEl = $("#spin-it"), positions = [fadeEl.offset().top,flyEl.offset().top,spinEl.offset().top,]; console.log(positions); Like that you could see where every element is when the tweens are created and if the problems is there or somewhere else. Hope this helps, Cheers, Rodrigo.
  8. Hi, In case you or anyone else is interested David DeSandro (a twitter developer) just released today a great piece of code called Images Loaded. It has a stand alone version (no library dependencies) and a JQuery plugin, you can see it here: http://desandro.github.io/imagesloaded/ Also has a progress setting and callbacks so that could work with what you're doing and it works with IE7+. Hope this helps, Cheers, Rodrigo.
  9. Hi Xnamex, Regarding the animation you mention that it seems to be ok. if that's the case I'll presume that your animation is working as expected but, how about when the error shows in the console?. You also mention that after you eliminated the line loading the ease pack things began to go wrong. Would you mind to elaborate a little bit more regarding that?. Cheers, Rodrigo.
  10. Hi and welcome to the forums. First if you load TweenMax.js it already comes with the ease pack, so no need to include it again. Second; is your animation working as expected?. If it is working, that will led me to think that the problem could be elsewhere, where exactly? I have no idea, in fact I didn't even knew that Qt could work with JS, thought that it was C++ only. Now if the animation is not working it would help if you provide a simple fiddle or codepen with the isolated problem. Cheers, Rodrigo.
  11. Hi, A third way could be a modification of Carl's second proposal. Create a TweenMax.from instance that's paused as a variable and set the progress of that instance with the timeline progress. Like this: var unleash_tl = new TimelineMax({onUpdate:progressBar, onUpdateParams:["{self}"]}), progressBar = TweenMax.from(redProgress, 1, {scaleX:0, paused:true}); /* unleash_tl.... */ function progressBar(tween) { progressBar.progress(tween.progress()); } You can see it working here: http://codepen.io/rhernando/pen/qaEto Hope this helps, Cheers, Rodrigo.
  12. Hi, Like Jack said delay is working but be aware that it'll work only in the first execution of the timeline, in further executions it won't work. Like Jack said the shift children should be, at least after the first one or after the childrens you want delayed by that amount of time. Imagine that you have an empty egg tray and another one with two eggs and someone tells you to move your eggs two "spaces", sure in the second tray there'll be no problem, but in the first one?, wouldn't be the most logical answer to say: "dude, the tray has no eggs, errrrr!!!!". That's pretty much what's happening, you're telling the timeline to move it's children by "delayTime" but at the moment you're saying that the timeline is empty, therefore there's nothing to move. It should be like this: tl .set (boxesParent, {perspective:400}) .to (box1, 0.7, {rotationY:-125, transformOrigin:"right top", ease:Expo.easeOut, onComplete:hideDiv, onCompleteParams:[box1]}, "initAni") .shiftChildren(delayTime, true, 0); I set up a little example so you can see both methods working: http://codepen.io/rhernando/pen/iodrh The sample has the delay method working, in order to see the shiftChildren() method working comment out line 9 and uncomment line 26; and reverse the process to go back to the delay method. Hope this helps, Cheers, Rodrigo.
  13. Hi, That's an odd behaviour, it should be working, are you using the latest version of the engine?. Try getLabelsArray() and see what you get, like this: var timelineLabels = tl_EscenasControl.getLabelsArray(); console.log(timelineLabels); That should return an array of the timeline labels and their respective times in the timeline. Also consider that seek doesn't change the playing state of the timeline, meaning that if the timeline is paused, after you use the seek() method it will remain paused. You can see a little sample here: http://codepen.io/rhernando/pen/omvJI It would help a lot if you could set a live sample, jfiddle or codepen with the isolated issue to get a better idea of what might be happening. Hope this helps, Cheers, Rodrigo.
  14. Hi Dave and welcome to the forums. Yeah an infinite slider is a simple thing with TimelineMax, but when you add user events to the flow things get a little complicated. I remembered a previous post that had a similar issue of unwanted behaviour, you can check it here: http://forums.greensock.com/topic/7523-proper-way-to-stop-jump-and-start-a-timeline/ I checked your code but after a while I decided to give it a try myself to get it done. My only guess with your first pen is that there are many functions going around, so my intentions was to simplify it as much as possible and, so far, I think is done, the code looks like this: var div1 = $("div#div1"), img1 = $("img#img1"), img2 = $("img#img2"), logDiv = $("div#logDiv"), pause = false, delayTime = 1,//standar delay time for repeat and initial play timerElem = {a:0}, tl = new TimelineMax({repeat:-1, yoyo:true, onRepeat:pauseCheck, repeatDelay:delayTime, paused:true}); tl.to([img1,img2], 1, {top:-250, onComplete:pauseCheck, onReverseComplete:pauseCheck}); div1.hover(hoverIn, hoverOut); //this function checks at every cycle if the timeline should be paused or not function pauseCheck() { logDiv.html('timeline pause is: <b>' + pause + '</b>'); if(pause) { tl.pause(); } } function hoverIn() { pause = true; } function hoverOut() { pause = false; tl.play(); } setTimeout(function(){tl.play();},1000 * delayTime); You can see it working here: http://codepen.io/rhernando/pen/KvFBf Also you could check this one too: http://codepen.io/rhernando/pen/ydfBb I still believe that the second pen is a better approach for any type of content slider because it gives you more flexibility. Hope this helps, Cheers, Rodrigo.
  15. Hi Andrei and welcome to the forums, Unfortunately the behaviour you're experiencing is expected. Basically transform origin is a css property that states the origin point of a particular transformation, in your case two rotations, but what it doesn't do is to translate the object, if you check the element's properties with firebug or developer tools, you'll see that the transform matrix numbers associated with translation never change, whereas the ones corresponding to rotation do change, therefore the values of X and Y are zero and zero, which means that you're object just rotated but never got translated to a new position. Then when the second tween of the timeline happens, it takes the rotated element with a transform origin point "left top", but since the image's still in its original position it's positioned with that rotation but with the new transform point, which is "right top". I made a simple image that I hope illustrates a little better what I'm saying: The blue square is the original element, the fuchsia one is the element rotated 90° CW with a transform origin "left top" and the green one is rotated 90° CW with a transform origin "right top". The red dots in indicates the transform origin of each square and the "TL" means top left to indicate where the top left corner is. My suggestion would be to keep just one transform origin and add translation in order to simulate a falling leaf, you could also make some experimentation with the bezier plugin in order to create a falling path. The bezier choice could mean a little more work but since you can orient the element to the bezier path you can forget about the rotation and focus just on the path and let GSAP do all the job for you. Hope this helps, Cheers, Rodrigo.
  16. No problemo, glad to help. Cheers, Rodrigo.
  17. Hi, The problem is that you're creating the second timeline and is active, ie, is playing since the moment you created it, so when you add the TweenLite instances the timeline playhead is not at the 0 position. However if you change your code to this: var animateSecondRound = new TimelineMax({paused:true}); function animateStuff2(){ animateSecondRound.add(TweenLite.to(myDivs, 3, {left:"+=100"})); animateSecondRound.play(); } It works as expected. I updated your fiddle so you can see it working: http://jsfiddle.net/5t9EU/4/ Hope this helps, Cheers, Rodrigo.
  18. Hi, The only thing I can think of is checking the timeline's _active status. That , as you might have guessed, tells you whether or not a timeline instance is active, by returning a boolean value. You mentioned a root timeline, so consider that this works different with an exportRoot timeline than a traditional timeline, for example the following code: var div1 = $("div#div1"), btn1 = $("button#btn1"), btn2 = $("button#btn2"), btn3 = $("button#btn3"), btn4 = $("button#btn4"), tl1 = new TimelineMax({paused:true, repeat:1, yoyo:true}), tl2; tl1.to(div1, 3, {x:300, y:200}); btn1.click(function() { tl1.play(0); }); btn2.click(function() { tl2 = TimelineLite.exportRoot(); }); btn3.click(function() { console.log(tl1._active); }); btn4.click(function() { console.log(tl2._active); }); When you check tl1 just when the page is loaded you get false, if you check tl2 you get an error (tl2 is still undefined ). Then if you export the root, but don't play tl1 and you check you'll get tl1 = false and tl2 = true (maybe Jack or Carl could explain that). Then if you play tl1 and check while it's playing you'll get true and true, and after the yoyo - repeat when all is done you'll get false and false. The point is that when you do the export root and the timeline hasn't played since being exported (it may have played before being exported) and check you'll get true even if the timeline is idle. And I'm going to leave it here because there's a huge electric storm here in the andes and i'll get a blackout any time. Hope it helps, Cheers, Rodrigo.
  19. Hi, It depens on what you're using to get your JS script going. In your case (for what I've seen of your samples) you're using window.onload = function(){}, and that function won't execute until everything in the DOM is completely loaded, meaning, styles, images, scripts, etc. So if you need your images to be completely loaded before tinkering with them, then window.onload is good. But if you need your images to be positioned before they load and you'll use JS for that positioning, then window.onload won't cut it and then you'll need the DomContentReady event, which is not crossbrowser, so in that case I'll recommend you to use JQuery, Prototype or another JS library that takes care of the crossbrowsers issues for you. The reason is that GSAP tweens or animates css properties of DOM elements, which brings the issue of what part of an image IS the DOM element. Is it the image data itself (for example a landscape view)?, no , the DOM element is the <img> tag actually, and therefore the engine operates over that element. Then once all the tags in the html code are in the DOM, JQuery's $(document).ready(); will take action, but that doesn't mean that the images are loaded, what's in the document is the <img> tag but not the data of the image url which is ultimately what we're interested in. My advice would be, if you're going to continue using window.onload, to create some sort of conditional logic outside that function for the animations working on the images, therefore nothing will happen unless every image is loaded (consider that we're talking about every image in the DOM so if you have a lot of image that could mean some patience from your visitors) and after that the animations could happen. Now that doesn't mean that you could take some action to the <img> tags outside the window.onload function, like positioning, changing opacity, etc. If you want to try with a library, like JQuery there are some very useful plugins out there to help you with this, one that is very simple, small and gets the job done is this one from Krio: https://github.com/krio/jquery-image-loader-plugin This one allows to use a simple callback when an image is loaded or track when all the images you're interested in tracking are loaded to enable some particular action. Before I used the load event (JQuery api) but it has been deprecated and it shouldn't work on some browsers, although I've just tried an old sample and worked fine with IE10, IE9, firefox 20, chrome 26, safari 5 and opera 12. As you'll see there's a lot into it but it sounds more complicated than it really is, you have to find what works better for you and your projects. Hope this helps, Cheers, Rodrigo.
  20. Hi, You could try a fromTo tween, like that the from value (autoAlpha:0) is render immediately and then GSAP takes it to 0.7, something like this: TweenMax.fromTo(element, 1, {autoAlpha:0}, {autoAlpha:.7/*here you can add callbacks, delay, ease, etc*/}); Check the api reference for more info on this method. Hope this helps, Cheers, Rodrigo
  21. Hi and welcome to the forums, A workaround would be to create two separated images one of the truck and another of the shadow, give them an absolute positioning inside the div element (so they end up one on top of the other) and create a simple timeline for changing the shadow opacity, like this: var tlShadow = new TimelineLite({paused:true}), Shadow = $("img#truckShadow"); //Set the alpha of the shadow to 0 TweenMax.set(Shadow, {autoAlpha:0}); tlShadow.to(Shadow, .2, {autoAlpha:1}); $("#toggle").click(function () { // Toggle the filter class: $(entity).toggleClass("shadowfilter"); // Update the toggle button text: if ($(entity).hasClass("shadowfilter")) { $("#toggle").html("toggle filter OFF"); tlShadow.play(); } else { $("#toggle").html("toggle filter ON"); tlShadow.reverse(); } }); You can see it working here: http://jsfiddle.net/tYZ8E/10/ Hope this helps, Cheers, Rodrigo.
  22. Hi, I read your posts and I understand what's going on, the thing is that I tried to put together a sample of your initial request thinking that in that way you could solve your issue. As far as the zero duration tween using the from() method, it is behaving correctly. I'm going to presume that your CSS states that the element's visibility property is set to visible, so before you create the tween the element is visible. Then when you create your TweenMax.from() with visibility:hidden in the vars, the engine understands that you want the property changed from hidden (the value passed in the vars) to visible (the original property value) and the engine does so over a time span of 0 seconds, ie, immediately, so as soon as the tween is created is executed and completed, that is why you have to use immediateRender:false and that is why I referred to your first post because I felt is the same issue now as it was then, just with the from method now and I wasn't clear enough in order to explain why it was happening. I hope this helps, Cheers, Rodrigo.
  23. HI Gabriel, The point is when you create a tween with a zero duration inside a timeline with a repeat:-1 (infinite repeats), the behaviour you're getting is the expected. When you create your object in the DOM it CSS visibility property is set to hidden by code (I'm assuming you're still using the code from your first post), until that point you can't see that object. Then you create the timeline and your object is still hidden. Finally you create the tweens inside the timeline and, even if your timeline is paused, the zero duration tween is rendered immediately. Then the timeline completes it first cycle and goes for the next one, at that point the engine takes all the original values it recorded before and starts again, in this case the original value the engine has is visibility:hidden for that particular element, so that is why in the first loop the image is visible. That can be solved by using immediateRender:false as part of the tween's vars, you can see a very simple example here: http://codepen.io/rhernando/pen/zIEqD The image on the left has immediateRender:true as default, and the one to the right has immediateRender:false Also if you use the set method curiously the immediateRender:false is not needed, any reason for that Jack and/or Carl?, you can see it here: http://codepen.io/rhernando/pen/AzJmI Hope this helps, Cheers, Rodrigo.
  24. Hi, You could use some of the plugins from this article in JQuery4u http://www.jquery4u.com/media/10-jquery-audio/ Or a more straightforward approach like this one in CSS-Tricks: http://css-tricks.com/play-sound-on-hover/ If you chack the demo of the latter, you'll see how simple that way is and how easily would be to replicate it with a GSAP callback. Hope this helps, Cheers, Rodrigo.
  25. Hi Arek, You're most welcome and thank you for the kind words!! If you're interested I've polished the code a little and made it work for elements with different heights, you can see it working here: http://codepen.io/rhernando/pen/dLxAJ If more questions arise feel free to ask. As far as putting my info on your site, no problem go ahead, a little free publicity never hurts, unless is bad publicity, but that's not the case here Greetings to el Oso y el Madroño as well as to La Puerta del Sol and that beautiful city and country, I hope to go back there some time. Cheers, Rodrigo.
×
×
  • Create New...