Jump to content
Search Community

Search the Community

Showing results for tags 'animate'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager
  • Supercharge

Categories

There are no results to display.


Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Personal Website


Twitter


CodePen


Company Website


Location


Interests

  1. Hi everybody, im new on gsap...playing with threejs, tween and audio visualizer. I have a group with some mesh as child 1 - I would like to animate each element of the mesh with a value created in RAF . 2 - I would like to make endless tween on rotation (unfortunally , "repeat: -1" its not working). Is there another elegant / better solution for do that. Thanks in advance for any help... On RAF i have some function: 1 for render() three scene and one for analyze the sound and pass the value on tween. So this... // The sound analyzer . function soundAnalyzer() { if ((cristal)&&(frequencyData)){ tl_cristal_rotationX = new TimelineMax({repeat:-1 }); analyser.getByteFrequencyData(frequencyData); if(typeof frequencyData === 'object' && frequencyData.length > 0) { scale_value = 9000 - frequencyData[1] * 35 ; scale_value_Low = 1800 - frequencyData[1] * 5 ; cristal.traverse( function ( child ) { if ( child instanceof THREE.Mesh ) { tl_cristal_rotation = new TimelineMax(); tl_cristal_rotation.to(child.rotation, scale_value_Low, { ease: Linear.easeNone, x: -360 , y: -360, repeat:-1 }) } }); tl_cristal_rotationX.to(cristal.rotation, scale_value , { ease: Linear.easeNone, x: -360 }) } } } // and here RAF loop and Render // animation loop function animate() { if(dae) { soundAnalyzer() } requestAnimationFrame( animate ); render(); stats.update(); } TweenLite.ticker.addEventListener("tick", render); //and render the scene function render() { renderer.clear(); camera.position.x += ( mouseX - camera.position.x ) * .015; camera.position.y += ( - mouseY - camera.position.y ) * .015; camera.lookAt(scene.position); composer.reset(); composer.render(scene, camera); composer.pass(OldVideoPass); composer.pass(BrightnessContrastPass); composer.pass(RGBSplitPass); composer.toScreen(); } Thank u very much and sorry for my English.. hope is readable..
  2. Because you are one of the people who knew Flash and understood what made it great, I thought I'd ask. I was originally going to title this post "Any chance Greensock could replace CreateJS in AnimateCC?" Then I realized what I was asking was a little bigger. However, that is the gist of what I'm wondering. Is there a way to use the Greensock library as the engine that drives the animation when publishing from AnimateCC instead of CreateJS? The CreateJS library isn't getting updates (worse than Flash and Air). It's slow on mobile. Interaction is unbearably laggy. It's essentially unusable for any decent experience. But Greensock has always been the bleeding edge of speed, efficiency and stability. If it were powering all the timeline tweens and interactions when users published to html5, Flash could again be a viable tool for creating animation and games on the web. The Flash tool provided a wonderful GUI with which to create animation and games for coders and noncoders alike. When you published, it just worked. Nearly a decade after its 'death' we still haven't found a suitable replacement. Greensock is great. But there are those of us who find it prohibitively difficult to animate with code. And maybe I should just be asking for a Greensock GUI that has a timeline and MovieClips like Flash. But Animate is there. And it might just need the power and performance of Greensock to make it live again.
  3. Hello, I'm trying to use the Draggable.create() method with an instance, in Animate CC (HTML), but i can't. I can use TweenMax, but Draggable is not possible. Of course, i added the link (<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.19.1/utils/Draggable.min.js"></script>) to my web page. Does anybody succeed in adding a drag and drop technic thanks to the Draggable.create() method? David Archive.zip
  4. please help me !! Sorry for the Google translation ( ㅠ_ㅠ) <style> .parent{width:500px; height:500px; background-color:#000} .parent .child1{position:absolute; width:100px;height:300px; display:none; background-color:#f00} .parent .box1{position:absolute; width:50px; height:50px; background-color:#0f0} .parent .child2{position:absolute; width:300px;height:300px; display:none; background-color:#00f} .parent.on .child1{width:50px; height:500px; display:block; background-color:#ff0;} .parent.on .box1{width:30px; height:30px; left:300px; top:300px;} .parent.on .child2{width:500px; height:30px; display:block; background-color:#0ff;} </style> <div class="parent"> <div class="child1"> <div class="box1"></div> </div> <div class="child2"> </div> </div> TweenMax.to(".parent", 1, {class:"+=on"}) //Does not work TweenMax.to(".parent .child1", 1, {class:"+=on"}) //Does not work I know that you can animate through classes. BUT How can I animate child elements through a class of parent elements?
  5. Hi All I'm sorry if this is an easy solution but I couldn't find it and I'm totally new. I have several elements with an infinite rotation but for some reason is working only the first one. Here is my code: (function($) { var green = $('.green'), red = $('.red'), brown = $('.brown'), // tl = new TimelineLite(); tl = new TimelineLite(); tl .to(red, 3, { rotation: "+=360", repeat:-1, ease: Linear.easeNone, transformOrigin:"50% 50%" }) .to(green, 1, { rotation: "+=360", repeat:-1, ease: Linear.easeNone, transformOrigin:"50% 50%" }, "-=0.15") .from(brown, 3.5, { rotation: "+=360", repeat:-1, ease: Linear.easeNone, transformOrigin:"50% 50%" }, "-=0.15"); })(jQuery); Thank you so much for your help!
  6. Hey there, I'm trying to use TweenMax to animate an image inside a SVG clipPath. The problem is: when the transition is happening, the clipPath deactivate on Chrome and appears only after animation stops. On Safari and Firefox works just fine. Anyone can help me? Is a compatibility issue or am I doing something wrong? Thanks guys!
  7. Hi Guys! I have a problem with my animation. I don't know why, only when I move mouse scroll or change width of codepen window, my animation start playing. I want to create continuous animation but I don't know what I'm doing wrong.
  8. Hello everyone! This is my first post here having started to learn jQuery very recently. Learning it is very exciting but there's so much to get your head around... I look at lots of websites and try to learn as much as I can. Can you tell me what would be the best way to achieve this effect- http://spain.madeforspainandportugal.com/en/ -background image looping around a circle or a path? Many thanks in advance!
  9. Hello all, a newbie here. I looked through the docs and examples, but am still a bit unsure whether the Timeline scripts could help me out with a project I'm tasked with. The project is a rather straightforward animation created in Flash/Animate which needs to be exported as SVG. The animation has four points at which the animation would need to stop. Each 'stop point' would have a corresponding button which moves the playhead backwards or forwards, depending if the clicked button is before or after where the playhead currently is at. As you might know, scripts do not go with the SVG when exporting it from Animate and so the solution would be to apply JavaScript or some such library to handle not only the navigation, but stopping the playhead at the 'stop points' or labels. Here are my initial questions/problems: * Using the TimelineLite/Max one can sequence tweens into a single timeline, but is it possible to add a single SVG animation (exported from Animate) that can be controlled with TimelineLite/Max? * Are the 'stop points' possible to implement with, say, applying labels at certain points (e.g. in seconds)? Please let me know if something needs clarification. Thanks in advance!
  10. I am currently working on a project where an animation along the line is implemented, i.e. a chosen SVG element (in this particular case a <g> ) is moved along a <path>. Previously, I have implemented this using Snap.SVG and it worked fine, however, having to also do some "morphing" on the elements, I decided to give MorphSVGPlugin a go to save resources. However, so far it has not been a smooth ride... Stepping through the code, I observe the following: 1. The object is rendered in a starting position (the correct starting position). 2. The line path is rendered (I used fill="blue" just to demonstrate the position of the line) - the starting point is supposed to be the top "corner", however, it is an invisible "looped" line. 2. The animation kicks in, and the object is instantly positioned somewhere else! This is the actual problem for me right now. 3. The object is animated along a correct curve! This makes me think that MorphSVGPlugin.pathDataToBezier method is working as intended and provides x-y array of movement points. However, TweenMax.to() method seems to disturb the intended starting point for the animation, I really can't put a finger on it right now. There is very little control I have over the artwork, which has been designed in AI and exported to SVG format. Hoping to find the resolution to this problem as soon as possible.
  11. Hi - I am trying to troubleshoot some animation stuttering in an app we built. I decided to include GSAP jQuery plugin to see if it would make a difference, but I'm not sure it's even being utilized over jQuery's native animate. How do I know? I include the library: <script src="script/vendor/TweenMax/TweenMax.min.js"></script> <script src="script/vendor/jquery/jquery.gsap.min.js"></script> Then here's a typical animation call: $(obj).stop().animate({ rgb: 127 }, { duration: 2000, easing: (Constants.CUSTOM_EASE ? Constants.EASE : "easeOutQuart"), step: function() { var rgb = ~~ obj.rgb; self.drawArrow(rgb * 65536 + rgb * 256 + rgb); } }); As far as judging performance, is there a good, definitive way to see which is operating faster? I have Chrome Dev Tools FPS counter open, but both platforms seem to operate mostly at 60fps in the counter, with the occasional (severe) dropoff - which is what I'm trying to solve for.
  12. Hello How can I draw a line with animation on canvas? I want to draw animating line on my canvas chart can I draw a line using as lineTo canvas method and make animate it with GSAP?
  13. Hi there! I need help to animate my trees, so, this is my scene: http://imgur.com/a/zaiwS It's all separated in svg, what i need is simulate the tree balance with wind, anyone can help me? Thanks a lot!!
  14. I would like to animate the gradient mask's position from right to left on image, how do you accomplish this using Tweenmax that is compatible for most browsers specially on Chrome & Firefox? **I was able to create a gradient mask in chrome using -webkit-mask-image but mask don't work on firefox** HTML: <div id="gradient mask"> <div id="myimage"></div> </div> CSS: #myimage { background-image: url(image.jpg); width: 259px; height: 194px; }
  15. Hi, Newbie here having trouble with animating on a path. I've managed to create a path using the bezier plugin included in tweenmax, but it is very inconsistent (path seems to be different each time). I'm looking to achieve the appearance of a piece of paper floating from one point to another - so a curved path, skewing, rotating etc. Any help would be greatly appreciated var tl = new TimelineLite({paused:true}) var trueTweenPoints = [ {top:'10%', left:'90%', rotation: 10}, {top:'75%', left:'75%', rotation: 80}, {top:'20%', left:'10%', rotation: 90} ]; tl.to(".trueTween", 0.8, {bezier:trueTweenPoints, type:"soft", curviness:1.25}); .trueTween { position: fixed; background: red; right: 4.5%; top: 30%; width: 160px; height: 300px; transition: All 0.4s ease; -webkit-transition: All 0.4s ease; -moz-transition: All 0.4s ease; -o-transition: All 0.4s ease; }
  16. Hi! I am new to GreenSock animation so do not know very much. Can anyone recommend to me some other animations that might look good for my animated graph? So far, I incorporated the autoAlpha, scaling, animate.css. I am trying to draw the top line from the circle but it keeps scaling from the top instead of the bottom. Even putting a transformOrgin of '0% 0%' will not help. Any tips would help. I learned GreenSock from the ihatetomatoes Greensock paid course. I keep referring to the videos as well. Thanks!
  17. Hello, I have a problem with Adobe Animate TimelineMax. The problem is that I need to navigate back and forward into the Animate timeline and play the same TimelineMax animations that afect to the same element in and out. in the first frame of animate keyframe I have one button and this: var root = this; root.stop(); root.chk1.visible = 0; root.continuar.visible = 0; function sigue0() { root.play(); } function entrar(vel) { root.boton1.disabled = true; tl0 = new TimelineMax({onComplete:sigue0}); tl0.from(root.boton1,vel,{x:root.boton1.x-150, alpha:0, ease:Back.easeOut},.0); } entrar(1); in the next frame I have this: var root = this; root.stop(); if (this.control == 1) { root.chk1.visible = 1; root.continuar.visible = 1; } function sigue1() { tl1.pause(0).clear(); root.play(); } this.boton1.addEventListener("click", fl_MouseClickHandler1.bind(this)); function fl_MouseClickHandler1() { this.control=1; root.chk1.visible = 0; tl1 = new TimelineMax({onComplete:sigue1}); tl1.to(root.boton1,1,{scaleY:2, scaleX:2,alpha:0},.0); } in the next yhis: var root = this; root.stop(); if (this.control == 1) { root.gotoAndPlay("op1"); } and in the label "op1" I have this: var root = this; root.stop(); this.volver.addEventListener("click", fl_MouseClickHandler1.bind(this)); function fl_MouseClickHandler1() { this.control=1; this.gotoAndPlay(0); } The problem is that the fisrt time I execute this the function "fl_MouseClickHandler1()" wait until every animation is finished and then execute "onComplete" and function "sigue1" but the second time the function "fl_MouseClickHandler1()" is executed it don't wait the animation of the elements and execute "onComplete". How can I fix that? I create elearning courses in Flash the last 10 years and now I want to do the same with animate but i need to navigate back and forward a lot of times in the Animate timeline. Sorry for my english and best regards, Eduardo
  18. Hello, I am so exited to use TweenMax but I am a flash novice. I want to start by tweaking a friends project and changing out some graphics, but Nothing I do will get these to work. I have attached a couple of samples, I would be eternally grateful if someone could tell how to make these simple examples work in my system so I can learn and train some students. I have the New Animate and Windows 10 64bit , if that matters in any way. I do not have the com folder in this obviously. Thanks, Steve SamplesFromCS6.zip
  19. Hi! We have been working on a new way to export faster, smaller HTML5 from Adobe Animate. As we are nearing launch we would love to hear about your experiences with Flash and Animate for HTML5. https://www.surveymonkey.com/r/Z3DNNQB Be sure to enter your email for a chance to download the product before launch!
  20. Hi there. I have just started using GSAP and want to animate the viewport attribute of the SVG inside a Object tag. This is the code I have but doesn't seem to work. var tl = new TimelineMax({delay:.5}), svgDoc = document.getElementById("SVGobject").contentDocument; TweenMax.set(svgDoc,{attr:{viewBox:"250 0 250 250"}}); tl.to(svgDoc, 1.5, {attr:{ viewBox:"0 0 1000 1000"}}); Once i have this working the ultimate aim is to trigger an animation of the viewport via an onClick event. Currently I just change the viewport via an array, so any help on this bit too would be very much appreciated. var interactions = { 'Button1' : '414 0 414 736', 'Button2' : '214 0 414 736', 'Button3' : '0 0 414 736', 'Button4' : '828 0 414 736', };
  21. Hi, new to these forums. I have a html5 banner I created in Animate for DCM with a click tag. Everything works fine, the link works if you click the banner, it validates in DCM html checker, but when i view the banner in a browser the cursor doesn't change to the hand/pointer cursor like it does on all links, banners. Any idea why this would happen? Any help would be much appreciated! Thanks!
  22. Hello, I'm mystified as to why the stroke on the red bar in my pen doesn't animate like the stroke on the white bar. The only difference I can see are the coordinates of the lines. Thanks
  23. GSAP Masters, Have come across a situation that you are all more than likely preloaded to fire back a response to explain why. The codepen example above is handled allot different in chrome as it is to firefox or internet explorer (all that I have tested at this stage). I was looking for a way to only transform on one shape but then pattern that render across the whole page as opposed to transforming lots of shapes all together (was killing my cpu). Chrome let me believe I was close to an answer until yeah the other browser checks bummed me out. Looking forward to your response. Cheers, Bundy
  24. Hi Everyone, I've created an edge animate website with 4 sections. Each section has some sort of simple animation to bring in content. The problem that I have is that when the user clicks on the navigation more than say 10-15 times the pages start seriously lagging until the page becomes unresponsive and crashes. I am testing this currently in Chrome and edge in IE. I have stripped this website right down to the bare bones and changed properties from Left and top to x and y and removed background images to see whether these things are causing the problem but the problem still persists. Here is the website and below is example code. Any help would be appreciated thank you. http://digital.akauk.com/_test/gsap/website/superhero.html Website code: // ----------------------------------------- SET VARIABLES ------------------------------------------------------- // TweenMax.defaultEase = Power2.easeInOut; // Stage dimensions var stageHeight = sym.$("Stage").height(); var stageWidth = sym.$("Stage").width(); var mainNavWidth = $("#Stage_mainNav").width(); var footerWidth = $("#Stage_footer").width(); var sHomeWidth = $("#Stage_sHome").width(); var sAboutWidth = $("#Stage_sAbout").width(); var sVideoWidth = $("#Stage_sVideo").width(); var sGalleryWidth = $("#Stage_sGallery").width(); sym.$("#Stage_mainNav").css({ "left": stageWidth/2 - mainNavWidth/2 }); sym.$("#Stage_footer").css({ "left": stageWidth/2 - footerWidth/2 }); sym.$("#Stage_sHome").css({ "left": stageWidth/2 - sHomeWidth/2 }); sym.$("#Stage_sAbout").css({ "left": stageWidth/2 - sAboutWidth/2 }); sym.$("#Stage_sVideo").css({ "left": stageWidth/2 - sVideoWidth/2 }); sym.$("#Stage_sGallery").css({ "left": stageWidth/2 - sGalleryWidth/2 }); // Background images sym.$("body").css({ "overflow-x" : "hidden" // Stop horizontal scrollbar }); var homeImage = sym.$("homeImage"); var aboutImage = sym.$("aboutImage"); var videoImage = sym.$("videoImg"); var galleryImage = sym.$("galleryImage"); homeImage.css({ "background-attachment": "fixed", "background-size": "cover", "-webkit-background-size": "cover", "background-position": "50% 50%", "background-repeat" : "no-repeat" }); aboutImage.css({ "background-attachment": "fixed", "background-size": "cover", "-webkit-background-size": "cover", "background-position": "50% 50%", "background-repeat" : "no-repeat" }); videoImage.css({ "background-attachment": "fixed", "background-size": "cover", "-webkit-background-size": "cover", "background-position": "50% 50%", "background-repeat" : "no-repeat" }); galleryImage.css({ "background-attachment": "fixed", "background-size": "cover", "-webkit-background-size": "cover", "background-position": "50% 50%", "background-repeat" : "no-repeat" }); // Main section containers var sHome = sym.$("sHome"); var sAbout = sym.$("sAbout"); var sVideo = sym.$("sVideo"); var sGallery = sym.$("sGallery"); var firstPlay = true; // Home section var flyingBoy = sym.getSymbol("sHome").$("flyingBoy"); var Logo = sym.getSymbol("sHome").$("Logo"); var homeImage = sym.$("homeImage"); var playerBg = sym.getSymbol("sHome").$("playerBg"); var footer = sym.$("footer"); var mainNav = sym.$("mainNav"); var buyNowBtn = sym.getSymbol("footer").$("buyNowBtn"); var facebookBtn = sym.getSymbol("mainNav").$("facebookBtn"); var twitterBtn = sym.getSymbol("mainNav").$("twitterBtn"); var animateFlyingBoy = new TweenMax(flyingBoy, 1.5, {paused:true, top:"56px", repeat:-1, yoyo:true, repeatDelay:0, ease:Linear.easeNone}); // About section var aboutImage = sym.$("aboutImage"); var aHeading = sym.getSymbol("sAbout").$("aHeading"); var text = sym.getSymbol("sAbout").$("Text"); var logo2 = sym.getSymbol("sAbout").$("logo2"); // Video section var videoImg = sym.$("videoImg"); var videoHeading = sym.getSymbol("sVideo").$("videoHeading"); var videoLogo = sym.getSymbol("sVideo").$("videoLogo"); var videoBtnLeft = sym.getSymbol("sVideo").$("arrowL"); var videoBtnRight = sym.getSymbol("sVideo").$("arrowR"); var videoThumbsContainer = $("#Stage_sVideo_containerHolder"); // Gallery section var aImagesGallery = ["images/img1.jpg", "images/img2.jpg", "images/img3.jpg", "images/img4.jpg", "images/img5.jpg", "images/img6.jpg"]; var totalImagesGallery = aImagesGallery.length; var slideToGallery = 0; var imageWidthGallery = 944; var tGallery; var arrowRGallery = sym.getSymbol(sGallery).$("arrowR"); var arrowLGallery = sym.getSymbol(sGallery).$("arrowL"); var containerGallery = sym.getSymbol(sGallery).getSymbol("containerHolder").$("container"); // Main nav button colours var bSelected = "#a21111"; var bNormal = "#ffffff"; // Main Nav Buttons var bHome = sym.getSymbol("mainNav").$("homeBtn"); var bAbout = sym.getSymbol("mainNav").$("aboutBtn"); var bVideo = sym.getSymbol("mainNav").$("videoBtn"); var bGallery = sym.getSymbol("mainNav").$("galleryBtn"); // Gallery var nextImage_btn = sym.getSymbol(sGallery).$("btnNext"); var prevImage_btn = sym.getSymbol(sGallery).$("btnPrevious"); var imageCount = 1; // Video var t; // Thumb reference var arrowR = sym.getSymbol(sVideo).$("arrowR"); var arrowL = sym.getSymbol(sVideo).$("arrowL"); var container = sym.getSymbol(sVideo).getSymbol("containerHolder").$("container"); var containerHolder = sym.getSymbol(sVideo).$("containerHolder"); var closeVideoBtn = sym.getSymbol(sVideo).$("closeVideoBtn"); var currentSection = "home"; //the section you are currently on var nextSection; //the section you are navigation to // Initialise call initialise(); // ---------------------------------------- INITIALISATION ----------------------------------------------- // function initialise() { //console.log("initialise"); enableNav(); initialStates(); prepPosAlpha(); showHomeSection(); disableNavElement(bHome); } // end initialise(); function initialStates() { //console.log("initialStates"); // Home section flyingBoy["origX"] = flyingBoy.position().left; Logo["origY"] = Logo.position().top; playerBg["origY"] = playerBg.position().top; // About section aHeading["origY"] = aHeading.position().top; text["origY"] = text.position().top; aboutImage["origX"] = aboutImage.position().left; // Video section videoHeading["origY"] = videoHeading.position().top; containerHolder["origY"] = containerHolder.position().top; videoBtnLeft["origX"] = videoBtnLeft.position().left; videoBtnRight["origX"] = videoBtnRight.position().left; // Gallery section arrowRGallery["origX"] = arrowRGallery.position().left; arrowLGallery["origX"] = arrowLGallery.position().left; containerGallery["origX"] = containerGallery.position().left; } // end initialStates(); function prepPosAlpha(){ //console.log("prepPosAlpha"); // Prep home flyingBoy["offStageX"] = "-500px"; TweenMax.set(flyingBoy, {scale:0, opacity:0, x:flyingBoy["offStageX"]}); TweenMax.set(Logo, {scale:2, opacity:0}); TweenMax.set(playerBg, {y: playerBg["origY"] + 25, opacity:0}); TweenMax.set(homeImage, {opacity:0}); // Prep About TweenMax.set(aboutImage, {opacity:0}); TweenMax.set(aHeading, {opacity:0, y:aHeading["origY"] + 25}); TweenMax.set(text, {opacity:0, y:text["origY"] + 25}); TweenMax.set(logo2, {opacity:0, scale:2}); // Prep video TweenMax.set(videoImg, {opacity:0}); TweenMax.set(videoHeading, {opacity:0, y:videoHeading["origY"] + 25}); TweenMax.set(videoLogo, {opacity:0, scale:2}); TweenMax.set(videoBtnLeft, {opacity:0, x:videoBtnLeft["origX"] + 125}); TweenMax.set(videoBtnRight, {opacity:0, x:videoBtnRight["origX"] - 125}); TweenMax.set(containerHolder, {opacity:0, y:containerHolder["origY"] + 25}); // Prep Gallery TweenMax.set(arrowLGallery, {x:arrowLGallery["origX"] - 125, opacity:0}); TweenMax.set(arrowRGallery, {x:arrowRGallery["origX"] + 125, opacity:0.5}); TweenMax.set(containerGallery, {x:containerGallery["origX"], opacity:0}); // Hide sections TweenMax.set([sHome, sAbout, sGallery, sVideo], {visibility:"hidden"}); } // Show section functions function showNextSection() { if(nextSection == "home"){ showHomeSection(); } if(nextSection == "about"){ showAboutSection(); } if(nextSection == "videos"){ showVideoSection(); } if(nextSection == "gallery") { showGallerySection(); } } // end showNextSection(); function showHomeSection(){ introHome(); currentSection = "home"; } function showAboutSection(){ introAbout(); currentSection = "about"; } function showVideoSection(){ introVideo(); currentSection = "videos"; } function showGallerySection(){ introGallery(); currentSection = "gallery"; } // ----------------------------------------- RESET SECTIONS ------------------------------------------------------- // function resetCurrentSection() { // console.log("resetCurrentSection"); // Reset sections by moving objects to original positions if(currentSection == "home") { resetHomeSection(); return; } if(currentSection == "videos") { resetVideoSection(); return; } if(currentSection == "about") { resetAboutSection(); return; } if(currentSection == "gallery") { resetGallerySection(); return; } } // end resetCurrentSection() function resetHomeSection() { // Pause video player //player.pauseVideo(); // Pause tweening boy animateFlyingBoy.pause(); // Hide player // Reset elements for homesection TweenMax.set(homeImage, {opacity:0}); TweenMax.set(Logo, {scale:2, opacity:0}); TweenMax.set(playerBg, {opacity:0, y:playerBg["origY"] + 25}); TweenMax.set(flyingBoy, {scale:0, opacity:0, x:flyingBoy["offStageX"]}); hideSections(); } // end resetHomeSection() function resetAboutSection() { // Send scrollbar to page top TweenMax.set(aboutImage, {opacity:0}); TweenMax.set(aHeading, {opacity:0, y:aHeading["origY"] + 25}); TweenMax.set(text, {opacity:0, y:text["origY"] + 25}); TweenMax.set(logo2, {opacity:0, scale:2}); hideSections(); } // end resetAboutSection() function resetVideoSection() { // Stop video player //fullscreenplayer.stopVideo(); // Hide videoplayer //$("#Stage_sVideo_fullscreenplayer").hide(); // Hide close button closeVideoBtn.hide(); // Show video buttons videoBtnRight.show(); videoBtnLeft.show(); // Reset objects TweenMax.set(videoImg, {opacity:0}); TweenMax.set(videoHeading, {opacity:0, y:videoHeading["origY"] + 25}); TweenMax.set(videoLogo, {opacity:0, scale:2}); TweenMax.set(videoBtnLeft, {opacity:0, x:videoBtnLeft["origX"] - 125}); TweenMax.set(videoBtnRight, {opacity:0, x:videoBtnRight["origX"] + 125}); TweenMax.set(containerHolder, {opacity:0, y:containerHolder["origY"] + 25}); TweenMax.set(container, {x:0}); slideTo = 0; videoBtnLeft.hide(); hideSections(); } // end resetVideoSection() function resetGallerySection() { // Reset arrows TweenMax.set(arrowLGallery, {left:arrowLGallery["origX"] - 125, opacity:0}); TweenMax.set(arrowRGallery, {left:arrowRGallery["origX"] + 125, opacity:0}); // Reset gallery slideToGallery = 0; // Reset containerGallery TweenMax.set(containerGallery, {left:containerGallery["origX"], opacity:0}); hideSections(); arrowLGallery.hide(); arrowRGallery.show(); } // end resetGallerySection() // --------------------------------------- HIDE SECTIONS ------------------------------------------------------- // function hideSections(){ // Hide Sections TweenMax.set([sHome, sAbout, sGallery, sVideo], {visibility:"hidden"}); } // ----------------------------------------- NAVIGATION ------------------------------------------------------- // buyNowBtn.bind("click", function(){ //console.log("buyNowBtn clicked"); }); buyNowBtn.bind("mouseover", function(){ TweenMax.to(this, 0.5, {opacity:0.7}); }); buyNowBtn.bind("mouseout", function(){ TweenMax.to(this, 0.5, {opacity:1}); }); facebookBtn.bind("click", function(){ //console.log("facebook clicked"); }); facebookBtn.bind("mouseover", function(){ TweenMax.to(this, 0.5, {opacity:0.7}); }); facebookBtn.bind("mouseout", function(){ TweenMax.to(this, 0.5, {opacity:1}); }); twitterBtn.bind("click", function(){ console.log("twitter clicked"); }); twitterBtn.bind("mouseover", function(){ TweenMax.to(this, 0.5, {opacity:0.7}); }); twitterBtn.bind("mouseout", function(){ TweenMax.to(this, 0.5, {opacity:1}); }); function enableNav(){ // Deselect buttons bHome.css("color", bNormal); bAbout.css("color", bNormal); bVideo.css("color", bNormal); bGallery.css("color", bNormal); // Home button bHome.bind("click", function(){ navControl($(this)); }) bHome.bind("mouseover", function(){ onOver($(this)); }) bHome.bind("mouseout", function(){ onOut($(this)); }) // About button bAbout.bind("click", function() { navControl($(this)); }); bAbout.bind("mouseover", function() { onOver($(this)); }); bAbout.bind("mouseout", function() { onOut($(this)); }); // Video button bVideo.bind("click", function() { navControl($(this)); }); bVideo.bind("mouseover", function() { onOver($(this)); }); bVideo.bind("mouseout", function() { onOut($(this)); }); //Gallery bGallery.bind("click", function() { navControl($(this)); }); bGallery.bind("mouseover", function() { onOver($(this)); }); bGallery.bind("mouseout", function() { onOut($(this)); }); } // end enableNav() function onOver(obj){ $(obj).css("color", bSelected); } function onOut(obj){ $(obj).css("color", bNormal); } function disableNavElement(btn){ btn.unbind("click"); btn.unbind("mouseover"); btn.unbind("mouseout"); btn.css("color", bSelected) } function navControl(obj){ // Kill all tweens TweenMax.killAll(false); resetCurrentSection(); var bName = $(obj).attr('id').substr(14); // $(obj) // Enable button enableNav(); if( bName == "homeBtn") { nextSection = "home"; disableNavElement(bHome); } if( bName == "aboutBtn") { nextSection = "about"; disableNavElement(bAbout); } if( bName == "videoBtn") { nextSection = "videos"; disableNavElement(bVideo); } if( bName == "galleryBtn") { nextSection = "gallery"; disableNavElement(bGallery); } // Display next section showNextSection(); } // ---------------------- HOME ------------------------------------------- // function introHome(){ //console.log("introHome"); //sHome.show(); TweenMax.set([sHome], {visibility:"visible"}); // Animate in elements if(firstPlay){ TweenMax.from(mainNav, 0.3, {opacity:0, immediateRender:false}); TweenMax.from(footer, 0.3, {opacity:0, immediateRender:false}); firstPlay = false; } TweenMax.to(homeImage, 0.5, {opacity:1, delay:0, immediateRender:false}); TweenMax.to(playerBg, 0.5, {y:playerBg["origY"], opacity:1, delay:0.3, immediateRender:false}); TweenMax.to(Logo, 0.5, {opacity:1, scale:1, delay:0.6, immediateRender:false, onComplete:function(){ //$("#Stage_sHome_player").show(); player.playVideo(); }}); TweenMax.to(flyingBoy, 1, {scale:1, immediateRender:false, x:flyingBoy["origX"], opacity:1, delay:0.9, onComplete:function(){ animateFlyingBoy.play(); } }); } // end introHome(); //------------------------ ABOUT ----------------------------------------// function introAbout(){ //console.log("introAbout"); //sAbout.show(); TweenMax.set([sAbout], {visibility:"visible"}); TweenMax.to(aboutImage, 0.5, {opacity:1, x:aboutImage["origX"], delay:0, immediateRender:false}); TweenMax.to(aHeading, 0.5, {opacity:1, y: aHeading["origY"], delay:0.3, immediateRender:false}); TweenMax.to(text, 0.5, {opacity:1, y :text["origY"], delay:0.6, immediateRender:false}); TweenMax.to(logo2, 0.5, {opacity:1, scale:1, delay:0.9, immediateRender:false}); } // end introAbout() //------------------------ VIDEO ----------------------------------------// function introVideo() { // console.log("introVideo"); // sVideo.show(); TweenMax.set([sVideo], {visibility:"visible"}); TweenMax.to(videoImg, 0.5, {opacity:1}); TweenMax.to(videoHeading, 0.5, {y:videoHeading["origY"], opacity:1, delay:0.3}); TweenMax.to(containerHolder, 0.5, {opacity:1, y:containerHolder["origY"], delay:0.6}); TweenMax.to(videoLogo, 0.5, {opacity:1, scale:1, delay:0.9}); TweenMax.to(videoBtnLeft, 0.5, {opacity:1, x:videoBtnLeft["origX"], delay:1.2}); TweenMax.to(videoBtnRight, 0.5, {opacity:1, x:videoBtnRight["origX"], delay:1.2}); } // end introVideo() //------------------------ GALLERY --------------------------------------// function introGallery(){ //console.log("introGallery()"); // Show gallery section // sGallery.show(); TweenMax.set([sGallery], {visibility:"visible"}); TweenMax.to(containerGallery, 0.5, {opacity:1, x:containerGallery["origX"]}); TweenMax.to(arrowRGallery, 0.5, {x:arrowRGallery["origX"], opacity:1, delay:0.3}); TweenMax.to(arrowLGallery, 0.5, {x:arrowLGallery["origX"], opacity:1, delay:0.3}); } nextImage_btn.click(function(){ imageCount++; sym.getSymbol("sGallery").$("photo").attr("src", "images/img"+ imageCount + ".jpg"); if(imageCount >= 5) { nextImage_btn.hide(); } else { nextImage_btn.show(); prevImage_btn.show(); } }); prevImage_btn.click(function(){ imageCount--; sym.getSymbol(sGallery).$("photo").attr("src", "images/img"+ imageCount + ".jpg"); if(imageCount <= 1){ prevImage_btn.hide(); } else { prevImage_btn.show(); nextImage_btn.show(); } }); // ------------------------- VIDEO SECTION -------------------------------- // var aVidThumbs = ["images/thumb01.jpg", "images/thumb02.jpg", "images/thumb03.jpg", "images/thumb04.jpg", "images/thumb05.jpg", "images/thumb06.jpg", "images/thumb05.jpg", "images/thumb06.jpg"]; var aYouTubeStr = ["-DaPBBOHfsA", "DlM2CWNTQ84", "DMEa0CJbAUs", "-DaPBBOHfsA", "DlM2CWNTQ84", "DMEa0CJbAUs", "-DaPBBOHfsA", "DlM2CWNTQ84"]; var totalImages = aVidThumbs.length; var slideTo = 0; var imageWidth = 253; // vidPlayer init $("#Stage_sVideo_fullscreenplayer").hide(); closeVideoBtn.hide(); closeVideoBtn.bind("click", function(){ footer.show(); fullscreenplayer.stopVideo(); TweenMax.to($("#Stage_sVideo_fullscreenplayer"), 0.5, {opacity:0, onComplete:function(){ $("#Stage_sVideo_fullscreenplayer").hide(); }}); // Hide close button $(this).hide(); }) TweenMax.set($("#Stage_sVideo_fullscreenplayer"), {opacity:0}); imageSymbolArray = []; photoBorderArray = []; vHolderBgArray = []; function traceSelected (symbolInTheArray){ $("#Stage_sVideo_fullscreenplayer").show(); closeVideoBtn.show(); footer.hide(); TweenMax.to($("#Stage_sVideo_fullscreenplayer"), 0.5, {opacity:1}); fullscreenplayer.loadVideoById({'videoId' : aYouTubeStr[symbolInTheArray.getVariable("index")]}); } // end traceSelected(); for(i=0; i<aVidThumbs.length; i++){ t = sym.createChildSymbol("videoHolder", container); t.$("photo").css({"background-image" : "url('" + aVidThumbs + "')"}); t.$("photoBorder").css({"opacity" : "0"}); photoBorderArray.push(t.$("photoBorder")); t.getSymbolElement().css({"position" : "absolute", "left":i*270+"px"}); // 253px + 17px for margin t.getSymbolElement().css({"cursor" : "pointer"}); t.setVariable("index",i); imageSymbolArray.push(t); } // For thumb click and large video $.each(imageSymbolArray, function( count, symbolInTheArray ){ //create jQuery reference to the item - not really needed here but shows how to do it. var menuItem = $(symbolInTheArray); //create a jQuery reference to the DIV element inside the symbol. var menuElement = $(symbolInTheArray.getSymbolElement()); //now you can bind interactivity to the menu items' DIVs menuElement.bind ("click", function(){ traceSelected(symbolInTheArray); }); } ) $.each(photoBorderArray, function( count, photoBorderInTheArray ){ //create jQuery reference to the item - not really needed here but shows how to do it. var borderPhotoItem = $( photoBorderInTheArray); //create a jQuery reference to the DIV element inside the symbol. //var menuElement = $(symbolInTheArray.getSymbolElement()); //now you can bind interactivity to the menu items' DIVs borderPhotoItem.bind ("mouseover", function(){ TweenMax.to(this, 0.5, {opacity:1}); }); borderPhotoItem.bind ("mouseout", function(){ TweenMax.to(this, 0.5, {opacity:0}); }); } ) // Hide left arrow arrowL.hide(); arrowR.bind("click", function(){ arrowL.show(); if(slideTo<totalImages-3){ slideTo++; slideContainer(); $(this).show(); } if(slideTo == totalImages-3){ $(this).hide(); } }); arrowL.bind("click", function(){ arrowR.show(); if(slideTo>0) { slideTo--; slideContainer(); } if(slideTo == 0) { arrowL.hide(); } }); arrowR.bind("mouseover", function(){ TweenMax.to(this, 0.3, {opacity:0.7}); }); arrowR.bind("mouseout", function(){ TweenMax.to(this, 0.3, {opacity:1}); }); arrowL.bind("mouseover", function(){ TweenMax.to(this, 0.3, {opacity:0.7}); }); arrowL.bind("mouseout", function(){ TweenMax.to(this, 0.3, {opacity:1}); }); function slideContainer() { TweenMax.to(container, .8, {left: -slideTo*(imageWidth+17)}); } // ------------------------ GALLERY ------------------------------------- // var galleryFirstPlay = true; for(j=0; j<aImagesGallery.length; j++){ //console.log(j); tGallery = sym.createChildSymbol("imgHolder", containerGallery); tGallery.$("photo").css({"background-image" : "url('" + aImagesGallery[j] + "')"}); tGallery.getSymbolElement().css({"position" : "absolute", "left":j*944+"px"}); } // Hide left arrow arrowLGallery.hide(); arrowRGallery.bind("click", function(){ if(slideToGallery<totalImagesGallery-1){ slideToGallery++; slideContainerGallery(); $(this).show(); } if(slideToGallery == totalImagesGallery-1){ $(this).hide(); } arrowLGallery.show(); }); arrowRGallery.bind("mouseover", function(){ TweenMax.to(this, 0.3, {opacity:0.7}); }); arrowRGallery.bind("mouseout", function(){ TweenMax.to(this, 0.3, {opacity:1}); }); arrowLGallery.bind("click", function(){ arrowRGallery.show(); if(slideToGallery>0) { slideToGallery--; slideContainerGallery(); } if(slideToGallery == 0) { $(this).hide(); } }); arrowLGallery.bind("mouseover", function(){ TweenMax.to(this, 0.3, {opacity:0.7}); }); arrowLGallery.bind("mouseout", function(){ TweenMax.to(this, 0.3, {opacity:1}); }); function slideContainerGallery() { //console.log("slide " + slideToGallery) TweenMax.to(containerGallery, .8, {left: -slideToGallery*imageWidthGallery}); }
  25. I have used GSAP for a few years now, after being introduced to it through college. I am a big fan and want to use it for animating a sequence in my portfolio site. I am testing a simple concept to see if I can make a much more complex sequence What I am trying to do is change an image at a specific point in the Timeline sequence - essentially changing the "src" path of the image. I have spent an hour or two now scouring the forums and searching online for a solution, and the only seemingly related issues are much more complex. I am aware of the possibility of using jQuery and the "attr" , however ideally I would like to keep it as simple as possible, and believe there should be a way to simply change the source of the image as a 'src' css property. I have tried it without the CSS Plugin, as well as spelling out the word. I have also ran a check on the image source to make sure it isn't a file-path issue. Here is the code as of now: <body> <img src="images/7.gif" id="seven"> </body> <script> var seven = document.querySelector("#seven"); var tl = new TimelineMax({delay: 2, repeat: 2, repeatDelay: 2}); window.onload = function() { tl.from(seven, 0.5, {autoAlpha: 0.5, x: +100}) .to(seven, 0.1, {y: + 100, x: + 300}) .to(seven, 0.4, {css:{src: "images/7777777.png"}}); var pathSource = String(seven.src); console.log(pathSource); } </script>
×
×
  • Create New...