Jump to content
Search Community

Search the Community

Showing results for tags 'javascript'.

  • 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

Found 298 results

  1. Hi All, I am new to GSAP and inexperienced with javascript so please bear with me. I am currently trying to make a Go To Top button that follows you down the page and when you click the button it brings you back to the top of the page and so far it has been working.... Unless you want to use it more than once. For some reason, I can't get it to play again after the first click. I have been using timeLineMax and scrollTo to achieve this so far. I have been trying something like this to fix it but no luck so if you can please point me in the right direction. // GO TO TOP BUTTON var goToTopTi = new TimelineMax({paused:true}); goToTopTi.to(window, 1, {scrollTo:{y:0}, ease:Power2.easeOut}); var isPressedGoToTop = 0; document.querySelector("#goToTopButton").addEventListener("click", function(){ if (isPressedGoToTop === 0) { goToTopTi.play().timeScale(1); isPressedGoToTop++; } else { goToTopTi.repeat().timeScale(1); } }); I also tried something similar with no "if" and just goToTopTi.play().timeScale(1); thinking it would simply play each time and no luck with that either. Thanks in advance for all your help, Tech Soul P.S. I am not using jquery on this site for speed reasons in case your thinking the answer is a jquery thing
  2. 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
  3. Hi, I am a coding rookie. I am stuck in the positioning. How can I always move the items towards center whatever the screen size is? http://codepen.io/wenjingfei/pen/RRNYeY Thank you!
  4. Hey guys, I have a dynamic template, where you can input css into the XML feed, and the banner will read that on run time and adjust the banner overwrite the styles using set: TweenMax.set(element, newValuesObject); And I've managed to cobble together bits of string replaces and RegEx: var myDynamicCSS = "color:#ffffff; background-color: #00ffbb; text-align: left; border: 1px solid green"; String.prototype.toCamelCase = function() { return this.replace(/^([A-Z])|[\s-](\w)/g, function(match, p1, p2, offset) { if (p2) return p2.toUpperCase(); return p1.toLowerCase(); }); }; const convertCSS2JS = (css) => { let frameCSS = css.replace(/([\w-.]+)\s*[^;]+);?/g, '$1:$2,'); frameCSS = frameCSS.replace(/,+$/, ''); let properties = frameCSS.split(', '); let frameCSSObj = {}; properties.forEach(function(property) { let cssProp = property.split(':'); let cssKey = cssProp[0].toCamelCase(); let cssValue = cssProp[1].trim(); frameCSSObj[cssKey] = cssValue; }); return frameCSSObj }; TweenMax.set(myDynamicElement, convertCSS2JS(myDynamicCSS])); But I'm unsure of how easily breakable this is? Codepen: http://codepen.io/joemidi/pen/GZVedX
  5. Hi, I was wondering if I can call directionalRotation plugin directly in Javascript. Something like: var shortAngle = TweenMax.directionalRotation("420_short"); > shortAngle = 60 I just need the value returned by the plugin, I'm not using it in a Tween or something. Is that possible?
  6. Hey guys! I am working up a new animated banner for my boss's site. I have 4 banners. Each one animated in to view and animated out of view. I just finished all their animations. I commented out the js and html for each individual banner while I worked on the animation. They are strung together as once leangthy animation due to my lack of knowledge with JS and Gsap but think it should work okay. However when I removed all my commented out JS and HTML to string all the animations together to play in "sequence" Every animation except the first example will lag into place and not show the whole animation. I am not really equipt to figure this out. I have no idea why it would act this way. The animations play smoothly when not linked together. You can see an example preview of my project here: http://portalpacific.net/Al/PennyGrab2.1/ And I have also included a zip file here for anyone willing to take a look at help me. http://portalpacific.net/Al/PennyGrab2.1/PennyGrab2.1.zip Thanks so much for your time! Any help at this point is beyond appreciated!
  7. Hi First of all, I'm a total JS noob so apologies if this is a really simple question. I'm trying to animate burning embers, based on this confetti codepen: http://codepen.io/MAW/pen/wBGvgW But it's reliant on jQuery - I need a jQuery-less solution, using only TweenMax, is this possible? Trying to change the code myself (http://codepen.io/htwinam/pen/EPOryg) just throws up endless errors and doesn't work so would be massively grateful for any help Thanks
  8. Hello, I am working with a banner that is 970x418. I am trying to create a parallax effect on y-scroll (drag). In order to do this, I assume that: 1) I need to create a "container div" with a "foreground div" and "background div," foreground on top of the background. 2) Set the container itself to scroll/drag and affect both div's together. 3) Change the speed the background div to be a little slower, in order to give the parallax illusion. So far, I haven't found anything that shows me how to work with dragging one item and using the info of that item to affect the positioning of another. I've seen sites that give code libraries like scrollMagic, but they are not easy when it comes to finding out how to do specific things, only what is shown in their examples. Please help.
  9. I'm not 100% sure this is the correct place to post this. I have a question about Flash Pro CC 2015 when using the canvas file type. When I create a movieclip and set the registration point to the top left corner and place it on the stage. When I change the properties in the Properties panel and set the x and y values to 0 it moves to the top left corner like it should. But when I set these values using javascript this.mc.x = 0 and this.mc.y = 0; It uses the center point of the movie clip. So the top and left half of my mc are off of the stage. I'm not sure why this is. Does it have something to do with how the DOM reads the js file? I would like to have it when I write that code that it does the same thing as it does on the stage when i use the properties panel Thanks!
  10. WANTED: An Experienced HTML5/JS Web Developer (who also specializes in using GSAP) Greetings GSAP Community, =D I am in the market for an experienced responsive, interactive, and/or animation web developer, who also considers themselves an expert in using GSAP? I am inexperienced in this field, but after researching to find exceptional information and reading many positive reviews holding GSAP in high regard, I am interested in hiring an experienced web developer to help bring an all-natural fully-layered vector map illustration to life on the web using GSAP? Basically, we have created an all-natural fully-layered vector map (perspective) illustration of an entire city/community/town/beach resort areas, but would love for it to have some constant moving elements and interactive elements to allow our target audience to become educated of how our business services operates? By chance, would anyone in the GSAP community forum have any recommendations on best way for us to find such a developer? Thank you very much for taking a few moments of your time to read my request for support in this matter and look forward to hearing from you. =) With Warmest Regards, Christopher
  11. Hey there. In my Project I use allot of Tweens. At a specific point it wish to reset all current tweens excluding a select few. I wish to store a variable on these Tween to exclude so when resetting all the current tweens these can be tracked an avoided. I've tried this sofar but when assigning the failed tag SStimer return undefined. Yet I can access this tween when using TweenMax.getAllTweens()[index]. Am i Missing something major here? trigger.SStimer = new TimelineMax({delay: 180}) .call(function () { console.log('Slow selection fired'); delete this }); trigger.SSTimer.failedTag = true;
  12. Hi there. I'm trying to call some code on an interaction, for example,on a close button click, but I want the code to execute only if certain conditions are met. I think I might have formatted that portion (the if statements) as AS3 (as that's what I'm more comfortable with). Can you take a look and tell me why my if statements aren't firing? It's a huge piece so a codepen would be tricky to recreate, but here is the code in question, hopefully it's enough to solve: function minimizeShoe() { //TweenMax.set("#plus1", {css:{zIndex:501}}); TweenMax.to("#panel2_box1", .35, {scaleX:0.334, scaleY:0.334, top:-17, left:0, delay:.2, transformOrigin:"left bottom", onComplete:layerShoe}); TweenMax.to("#panel2_info1", .15, {y:"+=128", delay:.1, force3D:false}); TweenMax.to("#plus1", .35, {y:"+=386", delay:.2}); TweenMax.to("#plus1_2", .35, {rotation:"-=90", delay:.2}); scale1.removeEventListener('click', minimizeShoe, false); } function minimizeJacket() { //TweenMax.set("#plus2", {css:{zIndex:501}}); TweenMax.to("#panel2_box2", .35, {scaleX:0.334, scaleY:0.334, top:-17, left:167, delay:.2, transformOrigin:"left bottom", onComplete:layerJacket}); TweenMax.to("#panel2_info2", .15, {y:"+=128", delay:.1, force3D:false}); TweenMax.to("#plus2", .35, {y:"+=386", x:"+=168", delay:.2}); TweenMax.to("#plus2_2", .35, {rotation:"-=90", delay:.2}); scale2.removeEventListener('click', minimizeJacket, false); } function minimizeFitbit() { //TweenMax.set("#plus3", {css:{zIndex:501}}); TweenMax.to("#panel2_box3", .35, {scaleX:0.334, scaleY:0.334, top:-17, left:333, transformOrigin:"left bottom", onComplete:layerFitbit}); TweenMax.to("#panel2_info3", .15, {y:"+=117", delay:.1, force3D:false}); TweenMax.to("#plus3", .35, {y:"+=386", x:"+=336"}); TweenMax.to("#plus3_2", .35, {rotation:"-=90"}); scale3.removeEventListener('click', minimizeFibit, false); } function layerShoe() { scaleText1.style.display = "none"; TweenMax.set("#plus2", {css:{zIndex:501}}); TweenMax.set("#plus3", {css:{zIndex:501}}); TweenMax.set("#panel2_box1", {css:{zIndex:500}}); scale1.addEventListener('click', scaleShoe, false); scale2.addEventListener('click', scaleJacket, false); scale3.addEventListener('click', scaleFitbit, false); expandBtn1.addEventListener('click', scaleShoe, false); expandBtn2.addEventListener('click', scaleJacket, false); expandBtn3.addEventListener('click', scaleFitbit, false); } function layerJacket() { TweenMax.set("#plus1", {css:{zIndex:501}}); TweenMax.set("#plus3", {css:{zIndex:501}}); scaleText2.style.display = "none"; TweenMax.set("#panel2_box2", {css:{zIndex:500}}); scale1.addEventListener('click', scaleShoe, false); scale2.addEventListener('click', scaleJacket, false); scale3.addEventListener('click', scaleFitbit, false); expandBtn1.addEventListener('click', scaleShoe, false); expandBtn2.addEventListener('click', scaleJacket, false); expandBtn3.addEventListener('click', scaleFitbit, false); } function layerFitbit() { TweenMax.set("#plus2", {css:{zIndex:501}}); TweenMax.set("#plus1", {css:{zIndex:501}}); scaleText3.style.display = "none"; TweenMax.set("#panel2_box3", {css:{zIndex:500}}); scale1.addEventListener('click', scaleShoe, false); scale2.addEventListener('click', scaleJacket, false); scale3.addEventListener('click', scaleFitbit, false); expandBtn1.addEventListener('click', scaleShoe, false); expandBtn2.addEventListener('click', scaleJacket, false); expandBtn3.addEventListener('click', scaleFitbit, false); } function ifStatements(){ if(scale1.position().y == 0) { minimizeShoe(); } if(scale2.position().y == 0) { minimizeJacket(); } if(scale3.position().y == 0) { minimizeFitbit(); } } function exitHandler(){ ifStatements(); } scale1, scale2, and scale3 are all variables of divs that get moved to the top - I want that checked with the if statement, and then it minimized using the minimize function I've created. It's all working great except the if statements they aren't executing properly. Hopefully this makes sense what I'm asking!
  13. My animation is slow but my various browser debugging tools don't show where the delay is happening. I will post again with specifics and a Codepen if this fails, but could someone take a look at my animation and tell me how they would approach understanding its performance? What tools do you use to see how long things are taking, how memory is being used, and where the bottlenecks are? http://catalyst.goodlookingsoftware.com/a/ Many thanks, Aaron
  14. I am trying to sync a short audio clip to fire at every 180px as a div scrolls horizontally. If this animation were linear, it would be easy...but I am using Power4.easeOut and I am not sure how to synchronize the audio clip with the rate of deceleration in the tween. Any help on this issue would be much appreciated! Essentially, I want the audio clip to fire every time one of those blue squares passes the green line in the middle (view codepen). $(document).ready(function() { // Animation Variables var target = $('.animation--scroll'); var animTime = 3; var random = Math.random() * 170; var rewardItem = $('.rewardItem-container'); // Audio Variables var scrollSound = new Audio('/img/animations/8bit_coin.wav'); // Animation Functions var tween = function(index) { TweenMax.to(target, animTime, { ease: Power4.easeOut, x: (index * -180) + 90 - random }); }; $('.toggle-animation').click(function() { tween(5); // this is where I want the sound to play, but in a loop at a decele // rated rate. scrollSound.play(); }); });
  15. I've been catching back up with Flash Pro and Greensock using the new Canvas and WebGL file formats. One thing I noticed is when I try to use relative numbers with Greensock I get unexpected results. In AS3 I would have use something like this TweenLite.to(mc, 1, {x:"500"}); and the mc would have moved 500px to the right of where it was sitting on the stage. When I use the same piece of code in Flash Pro in JS instead of AS3 TweenLite.to(this.mc, 1, {x:"500"}); The mc seems to move to a location that is far more then 500px and not always in the direction that I thought it would move.. Since I'm using Flash Pro I'm not sure I can recreate this in codepen? Again this might be an issue with CreateJs and not GSAP.
  16. I've been using the 'scrollTo' plugin to scroll my divs, but now I need to implement that same functionality to affect an iframe. Is this possible?
  17. Hello! I'm creating a banner using Flash CC HTML5 canvas. What I do is adding animation code to each frame. After it completes I want the next frame to be played. I included two libs into the HTML file: EasePack.min.js TweenLite.min.js So at the current frame I am writing the following code (source file: test7.zip ): this.stop(); TweenLite.to(this.target, 1.35, {delay: 0.1, y: 180, ease:Elastic.easeInOut, onComplete: pplay } ); function pplay(){ this.play(); window.alert('123'); }; The frame is animated but it stops at the end instead of going to next frame. At this time the alert works, but I can not skip it - it's like a loop function. How can I get to the next frame? P.S. Previously I worked with greensock AS2 at Flash CS 6 - everything worked perfect. Best regards, Vital
  18. Hi everyone ! Hope you are fine. I come to you because I am trying to make a carousel with images fading in / out. I decided to use opacity (maybe it's not the best way to do it) and JS. I succeed to do something with JQuery but the performance were a disaster. Made my browser (chrome) crash. Then I decided to make it with javascript and tried to realise something as light as possible (hard task). But, when I thought my algorithm was good I was in front of 2 problems : 1) I don't succeed to make it infinite (not too hard to do) 2) I have an error during a loop : Cannot tween a null target. I put some console.log everywhere at every stage but impossible to localise the moment where I am sending a null object to TweenLite. Dafuq So, as you will see in my (short) codepen, am I missing something ? I deeply thank you in advance for the time spend on my request.
  19. Dear All, I am using the Avada theme + ScrollMagic, but I get this following error in the console in Firefox: ReferenceError: TweenMax is not defined In the theme's functions.php I am trying to enqueue the scripts and add/delete dependencies, but I still can't get it to work: wp_enqueue_script( 'jquery', false, array(), $theme_info->get( 'Version' ), true ); //LAURAN BEGIN//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //wp_deregister_script( 'TweenMaxMin' ); wp_register_script( 'TweenMaxMin', $template_directory . '/assets/js/1lauran/TweenMax.min.js', array(), $theme_info->get( 'Version' ), true ); wp_enqueue_script( 'TweenMaxMin' ); //wp_deregister_script( 'ScrollMagic' ); wp_register_script( 'ScrollMagic', $template_directory . '/assets/js/1lauran/ScrollMagic.js', array(), $theme_info->get( 'Version' ), true ); wp_enqueue_script( 'ScrollMagic' ); //wp_deregister_script( 'animationGsap' ); wp_register_script( 'animationGsap', $template_directory . '/assets/js/1lauran/plugins/animation.gsap.js', array(), $theme_info->get( 'Version' ), true ); wp_enqueue_script( 'animationGsap' ); //wp_deregister_script( 'debugAddIndicators' ); wp_register_script( 'debugAddIndicators', $template_directory . '/assets/js/1lauran/plugins/debug.addIndicators.js', array(), $theme_info->get( 'Version' ), true ); wp_enqueue_script( 'debugAddIndicators' ); //wp_deregister_script( 'lauranScrollMagic' ); wp_register_script( 'lauranScrollMagic', $template_directory . '/assets/js/1lauran/lauranScrollMagic1.js', array(), $theme_info->get( 'Version' ), true ); wp_enqueue_script( 'lauranScrollMagic' ); //LAURAN EINDE///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// And this is my script: //jQuery(document).ready(function($){ jQuery(document).ready(function(){ // place custom JS here console.log("DOM ready"); // window, links, and other assets loaded jQuery(window).on("load", function(){ // or place custom JS here to make sure DOM is ready and the window is loaded console.log("window, links, and other assets loaded"); var images = [ "http://blabla.com/wp-content/themes/Avada/img/example_imagesequence_01.png", "http://blabla.com/wp-content/themes/Avada/img/example_imagesequence_02.png", "http://blabla.com/wp-content/themes/Avada/img/example_imagesequence_03.png", "http://blabla.com/wp-content/themes/Avada/img/example_imagesequence_04.png", "http://blabla.com/wp-content/themes/Avada/img/example_imagesequence_05.png", "http://blabla.com/wp-content/themes/Avada/img/example_imagesequence_06.png", "http://blabla.com/wp-content/themes/Avada/img/example_imagesequence_07.png" ]; // TweenMax can tween any property of any object. We use this object to cycle through the array var obj = {curImg: 0}; // init controller // create tween var tween = TweenMax.to(obj, 0.5, { curImg: images.length - 1, // animate propery curImg to number of images roundProps: "curImg", // only integers so it can be used as an array index repeat: 3, // repeat 3 times immediateRender: true, // load first image automatically ease: Linear.easeNone, // show every image the same ammount of time onUpdate: function () { $("#myimg").attr("src", images[obj.curImg]); // set the image source } } ); var controller = new ScrollMagic.Controller({loglevel: 3}); // build scene var scene1 = new ScrollMagic.Scene({triggerElement: "#imagesequence", duration: 220}) .setTween(tween) .addIndicators() // add indicators (requires plugin) .addTo(controller); var scene2 = new ScrollMagic.Scene({triggerElement: ".box2"}) .setTween("#animate1", 0.5, {backgroundColor: "green", scale: 2.0}) // trigger a TweenMax.to tween .addIndicators({name: "1 (duration: 0)"}) // add indicators (requires plugin) .addTo(controller); var scene3 = new ScrollMagic.Scene({triggerElement: '#containerLauran',duration: 300}) .setPin('#blockLauran') .addIndicators() .addTo(controller); var scene4 = new ScrollMagic.Scene({triggerElement: '#containerLauran2',duration: 200}) .setPin('#blockLauran2') .addIndicators() .addTo(controller); }); }); All scripts seem to have been added/enqueued correctly if I check the html structure with the Firefox inspector. All scripts are added in the right order as enqueued in the functions.php file of the WP-theme. Can someone help me out? It looks like if I am almost there... Thanks! Lauran
  20. I just give my first try to JS gsap & html Jumped from actionscript Animating is nice and fun and work perfect here topic. When I upload to my server, I realise a problem. It first load all images and text and then ...starting the animation. Is there any method to load first and then start the animation? *All scripts are loaded inside head tag Thanks
  21. So on this website, I use Timeline to set up and intro animation on the home page. When I host it, I'll set a cookie script so it'll only happen the first time you hit the home page, but for now, it's part of the problem. I have CSS statements and media queries interacting with my script and it just occurred to me that I have queries in my script for the different values and dimensions of the animations based on screen size. It's hard to explain, but as I'm new to GSAP, I cannot think for the life of me how to make them now conflict. I've attached the files needed. Any help would be greatly appreciated. Maybe you can see what I'm going for. Sorry if it's a cluster****. It's been a messier process than usual. website.zip
  22. I've seen a lot of posts about media queries and running animations on screen size, but I haven't seen any that I can use for my problem. My problem is that between the mobile/tablet and desktop versions, the original logo is a different percentage size and is scaled down to a different size. Forgive my code. It's a little sloppy at the moment. But as you can see, on the desktop version, the original img width is 50%, and on mobile/tablet, it's 90%, so the post-animation sizes will be different as well. Can anyone help with this? Thank you.
  23. Actually I am making a web app which part of it contains a touch swipe action in order to browse between different parts of a section in mobile devices of course, the elements which move after the user swipes will be dynamically added or removed; I have made a static version of this so far but I need to make sure it is capable of being dynamic, I have used hammer js for controlling swipe action and tweenmax js for handling the animation. My problem is that I do not know how to recognize which .chanel element is in sight so I can figure out which is the next one and which is the previous one (how to Pass that element to my timeline instead of writing too many timelines), Also I have to dynamically change my Timeline in a way that it sets the .chanel element left to -offset if its the previous one and sets to offset if its the next one for example. I hope I could describe my problem well. Thanks in advance.
  24. Hi all, Fairly new to the whole javascript tweening animation business. I've included a fairly complex svg file in a website I'm working on via an <object> tag and am using GSAP to animate it. //GSAP tweening/animation STUFF $(document).ready(function(){ var svg = document.getElementById("homeAnimation"); var svgDoc = svg.contentDocument; var homeSwitch = svgDoc.getElementById("homeSwitch"), homeSmallGear = svgDoc.getElementById('homeSmallGear'), homeBigCog = svgDoc.getElementById('homeBigCog'), homePipeBall1 = svgDoc.getElementById('homePipeBall1'), homePipeBall2 = svgDoc.getElementById('homePipeBall2'), homePipeBall3 = svgDoc.getElementById('homePipeBall3'), homePipeBall4 = svgDoc.getElementById('homePipeBall4'), homeBeltGearLeft = svgDoc.getElementById('homeBeltGearLeft'), homeBeltGearRight = svgDoc.getElementById('homeBeltGearRight'), homeChart = svgDoc.getElementById('homeChart'), phoneChart = svgDoc.getElementById('phoneChart'), phonePie = svgDoc.getElementById('phonePie'); var tmax_home_switch = new TimelineMax(); //Switch has separate timeline so it can pause the animation but still move. var tmax_home_chart = new TimelineMax({repeat:-1}); //Chart has separate timeline so it can repeat. var tmax_options = { }; //options config goes here var tmax_home_tl = new TimelineMax(tmax_options); //timeline takes options input and is declared var tmax_repeat_options = { }; //options config goes here var tmax_home_t2 = new TimelineMax( tmax_repeat_options); //timeline takes options input and is declared //Clear the stage tmax_home_tl.set([homePipeBall1, homePipeBall2, homePipeBall3, homePipeBall4], {opacity:0}); tmax_home_tl.set(homeChart, {x:-20}); tmax_home_tl.set(phoneChart, {scale:0, transformOrigin: "center center"}); tmax_home_tl.set(phonePie, {scale:0, transformOrigin: "center center"}); //starts off paused tmax_home_tl.pause(); tmax_home_t2.pause(); tmax_home_chart.pause(); // mouseover cursor change. homeSwitch.addEventListener("mouseover", funcover, false); function funcover() { homeSwitch.style.cursor = "pointer"; } homeSwitch.addEventListener("click", function() { tmax_home_switch.to(homeSwitch, 0.2, { rotation: 60, repeat:0, delay:0.2, transformOrigin: "center center"}) .to(homeSwitch, 0.1, { rotation: 0, repeat:0, delay:0, transformOrigin: "center center"}); tmax_home_tl.paused(!tmax_home_tl.paused()); tmax_home_t2.paused(!tmax_home_t2.paused()); tmax_home_chart.paused(!tmax_home_chart.paused()); if(tmax_home_tl.set([homePipeBall1, homePipeBall2, homePipeBall3, homePipeBall4], {opacity:1})) { TweenMax.set([homePipeBall1, homePipeBall2, homePipeBall3, homePipeBall4], {opacity:0}); } }); tmax_home_chart.to(homeChart, 0.25, { x:50, transformOrigin: "center center"}, 8) .to(homeChart, 0.5, { y:26, transformOrigin: "center center"}) .to(homeChart, 20, { x:500, transformOrigin: "center center"}); tmax_home_tl.staggerTo([homePipeBall1, homePipeBall2, homePipeBall3, homePipeBall4], 0.5, { opacity:1 }, 3.4) .staggerTo([phoneChart, phonePie], 0.5, { scale:1, transformOrigin: "center center"}, 0.5); tmax_home_t2.to(homeSmallGear, 4, { rotation: 360, repeat:-1, ease: Power0.easeNone, transformOrigin: "center center"}, "cogs") .to(homeBigCog, 8, { rotation: 360, repeat:-1, ease: Power0.easeNone, transformOrigin: "center center"}, "cogs") .to([homeBeltGearLeft, homeBeltGearRight], 8, { rotation: 360, repeat:-1, ease: Power0.easeNone, transformOrigin: "center center"}, "cogs+=4"); }); There is the code all the elements being selected are definitely in the SVG file that is being imported. It seems to randomly work and other times not. Any suggestions? I'm getting a "Uncaught Cannot tween a null target." in Chrome but it works fine in Firefox and sometimes IE. Here is the bones of the site: http://www.mulrooneydesign.com/apps/infov4/ I'm guessing that the GSAP code is firing before the SVG DOM is instantiated any way to avoid this happening? Also any critique of my code generally is more than welcome. B
  25. Hello everyone, I am new to GSAP and I need your help to convert a CSS keyframe animation in a javascript one with GSAP. @keyframes elliptical-anim { 0% { transform: translate3d(0,150%, 0) rotate3d(0, 0, 1,0deg) translate3d(0,-150%, 0) rotate3d(0, 0, 1,0deg) scale3d(.1,.1,1); } 20% { transform: translate3d(0,150%, 0) rotate3d(0, 0, 1,-72deg) translate3d(0,-150%, 0) rotate3d(0, 0, 1,72deg) scale3d(1,1,1); } 96% { transform: translate3d(0,150%, 0) rotate3d(0, 0, 1,-359deg) translate3d(0,-150%, 0) rotate3d(0, 0, 1,359deg) scale3d(1,1,1); } 100% { transform: translate3d(0,150%, 0) rotate3d(0, 0, 1,-359deg) translate3d(0,-150%, 0) rotate3d(0, 0, 1,359deg) scale3d(.3,.3,1); } } I'm using the 3D version of the animations in order to force the hardware acceleration. Thanks in advance for your help !
×
×
  • Create New...