greensock

React - animate mount and unmount of a single component

拜拜、爱过 提交于 2020-04-07 10:48:12
问题 Something this simple should be easily accomplished, yet I'm pulling my hair out over how complicated it is. All I want to do is animate the mounting & unmounting of a React component, that's it. Here's what I've tried so far and why each solution won't work: ReactCSSTransitionGroup - I'm not using CSS classes at all, it's all JS styles, so this won't work. ReactTransitionGroup - This lower level API is great, but it requires you to use a callback when the animation is complete, so just using

How do I rotate or scale (transform) an SVG path relative to its center point?

五迷三道 提交于 2019-12-29 08:50:50
问题 I'm trying to rotate and scale shapes within an SVG around their center point. I've looked into several libraries, including Jquery, Greensock, D3, RaphaelJS, but I haven't been able to find any that provide a straightforward way to accomplish this. Each animates the shape from the origin point (which I understand is the default). I want to be able to spin a shape around its center point or scale it up or down from the center point. Here are a couple examples using Greensock and D3 that

Stop iteration when end of data objects are reached

爱⌒轻易说出口 提交于 2019-12-25 04:13:13
问题 Using the TweenMax library, I am unable to kill or stop a delayedCall when the end of the data object is reached instead of looping because it is a self calling function. https://jsfiddle.net/rdzo13cf/6/ In the example above the last item in the data is not displayed. 回答1: Actually it's because you are incrementing your iter variable before you set it. Which causes it to not display the last item, you want to increment after: function setContent() { element.html(data[iter].content); iter =

Fading in different items and different times using Greensock Tween

房东的猫 提交于 2019-12-23 04:15:49
问题 I am really new with GSAP and I think it is amazing. However I cannot work out how to fade in these items separately. 1st one (this is fine) for the 2nd wish to fade in at a certain time and 3rd at a certain time. JavaScript: function startFinalAnimation(){ var fa = new TimelineLite(); fa.to(finalAvatar, 2, {scale: 0.45, delay: 0, opacity: 1, transformOrigin:"-3% 8.8%"}); fa.to(finalContent, 4, {delay: 0, opacity: 1}); fa.to(logo, 5, {delay: 0, opacity: 1}); } 回答1: TimelineLite 's .to()

How to animate a line in canvas

无人久伴 提交于 2019-12-13 19:06:24
问题 I am trying to animate a line using canvas. I want to use TimelineLite to handle the animation. How would I do this? I know that in TimelineLite, the Timelines look like this: var timeline = new TimelineLite(); timeline.to(target, duration, vars, position); The points exist in a JSON file, and the file is correctly being brought in with AJAX. I want the line to start at the points x1 & y1, keep x2, as the same value, and animate it to the y2 position. So I basically want it to grow from x1-y1

KineticJS and Tween Timelines, integrating with GSAP JS

大城市里の小女人 提交于 2019-12-12 19:41:18
问题 as of version 4.5.1 the old Transition class has been retired and "KineticJS recommends the GreenSock Animation Platform which integrates seamlessly". I am writing a canvas game using KineticJS which relied quite heavily on that old Transition class but having read up on GSAP's abilities I'm quite keen to upgrade. My problem is that when I try using even the simplest TweenLite functions they are completely ignored by my canvas. I'm guessing I must be missing something obvious because I haven

Using greensock with browserify

对着背影说爱祢 提交于 2019-12-12 14:07:11
问题 I'm not able to get TweeLite to work with browserify. I'm an extreme noob when it comes to CommonJS. I've installed gasp v1.13.2 using Bower and include it like this: var TweenLite = require("../../bower_components/gsap/src/minified/TweenLite.min.js"); I don't get any errors when using it, but my animations don't work. According to gsap docs this version should work without a shim. What am I doing wrong? Can anyone provide a working example? https://greensock.com/gsap-1-13-1 I've just started

JQuery/GSAP - Moving multiple elements parallel to each other

被刻印的时光 ゝ 提交于 2019-12-12 03:37:16
问题 What I want to do is this: I want to generate boxes on the Y or X axis of the page (the bottom and left border) and make them move parallel to each other until they've gone off-screen, where I want to delete them. This is what I've done so far: Codepen . function generate(){ var $element = $("<div>", {class: "box"}); //Generate random x and y coordinates var posy = (Math.random() * ($('body').height() - $element.width())).toFixed(); var posx = (Math.random() * ($('body').width() - $element

How to animate correctly a GSAP menu?

天涯浪子 提交于 2019-12-08 13:23:33
问题 Holla, I need to reset the animation when I close menu and open it again. How can I do that? Animation works only the first time when I open menu. CSSPlugin.defaultTransformPerspective = 600; TweenMax.staggerFrom('ul#menu li', 1.5, {rotationX:-90, transformOrigin:"50% 0%", ease:Elastic.easeOut}, 0.4); Here is the code: http://codepen.io/hafsadanguir/pen/qOdaab. Thanks for help! 回答1: Is this the kind of result you were after? JavaScript: CSSPlugin.defaultTransformPerspective = 600; var

How to adjust a Greensock.js tween based on browser scroll y position rather than by the time?

与世无争的帅哥 提交于 2019-12-08 10:48:47
问题 How would I go about adjusting the time manually based on the scroll position? What might that look like? To basically 'scroll' the tween? So that the tween reacts to the scrolling mouse's Y position rather than just trigger and execute based on a preset time? 回答1: While Tahir's answer is correct and sufficient, there's a lot of unnecessary code to show the example. A more concise snippet is: var max_scroll = document.body.offsetHeight - window.innerHeight; win.addEventListener('scroll',