Jump to content
Search Community

OSUblake last won the day on September 16 2023

OSUblake had the most liked content!

OSUblake

Moderators
  • Posts

    9,196
  • Joined

  • Last visited

  • Days Won

    708

Posts posted by OSUblake

  1. That's not valid JavaScript. You can use backticks for multi-line strings.

     

    const shadow = `0 1px 0 hsl(43, 35%, 47%), 0 2px 0 hsl(43, 35%, 40%),
    				0 3px 0 hsl(44, 35%, 35%), 0 4px 0 hsl(44, 35%, 30%),
    				0 5px 0 hsl(44, 35%, 27%), 0 6px 0 hsl(43, 35%, 25%),
    				0 7px 0 hsl(42, 35%, 23%), 0 8px 0 hsl(42, 35%, 21%),
    				0 0 1px rgba(162, 138, 78, 0.05), 0 1px 3px rgba(162, 138, 78, 0.2),
    				0 3px 4px rgba(162, 138, 78, 0.2), 0 5px 5px rgba(162, 138, 78, 0.2),
    				0 10px 6px rgba(162, 138, 78, 0.2), 0 20px 7px rgba(162, 138, 78, 0.3)`;

     

     

    • Like 3
  2. 1 minute ago, JohnJesse said:

    This is resolved if I import from `gsap` instead.

     

    That's a problem with how typescript looks for definitions. When you use "gsap/all", it looks for a package named gsap/all, which of course doesn't exist. So you either have to import from "gsap" in at least 1 file, or tell the compiler where the definitions are in a tsconfig. See the FAQ.

    https://greensock.com/docs/v3/Installation

     

    {
      "compilerOptions": {
        ...
      },
      "files": [
        "node_modules/gsap/types/index.d.ts"
      ]
    }

     

    • Like 2
  3. On 3/22/2020 at 2:52 PM, Aquasar said:

    As a gsap newbie, do you know the difference between using gsap and TweenMax ? I see lots of tutorials using TweenMax and TimeLineMax and my thought it that the following imports both max versions?

     

    TweenLite, TweenMax, TimelineLite, and TimelineMax is the old syntax. gsap is the new syntax, so use that instead.

    • Like 5
  4. 3 hours ago, wolfduck said:

    Hi @Rodrigo, is there a reason you create your timeline in state? Why not just declare it within useEffect with a const variable name?

     

    How would you reverse it outside the function? With hooks, everything goes bye-bye on every render if you don't store it the "React way".

     

    And you don't need to use state. A ref is fine, but it adds more noise to your code because you have to use .current

    https://codesandbox.io/s/react-hover-forward-ref-pthnx

     

     

    • Like 4
  5. 1 hour ago, Aivars said:

    Taking in consideration that groups mostly consist of path elements which doesn't support x and y attributes.

     

    <g> elements support transforms.

     

    1 hour ago, Aivars said:

    By using simply gsap.to(objects, {y: number}) , I just get the elements to move y pixels down and not to the same y position.

     

    You need to calculate the difference between the position of a <g> element and the point you want. Something like this.

     

    var parts = document.querySelectorAll('#CarParts > g:not(#FordLogo)');
      
    gsap.killTweensOf(parts);
        
    gsap.to(parts, {
      y: (index, element) => {
        var box = element.getBBox();      
        return 300 - box.y - box.height;
      }
    });

     

    Also, you're creating a ton of <use> elements because you're calling the fordLogoClicked function for every part.

    • Like 3
  6. 9 minutes ago, ZachSaucier said:

    But I'll leave it up to you and @OSUblake, if he's interested, to determine why that's the case since it's unrelated to GSAP.

     

    Not really. I locked that thread because I don't feel like answering anymore scroll related questions. At least not for free. However, that code is free for anyone to use and modify.

     

    All I can say is that the problem is most likely related to the fact that you are creating the scroller when the body height is different because of your intro animations. It should be created when the page is ready for scrolling, and everything is in place.

     

    And if needed, I think you can force it to reset by doing something like this.

    scroller.scrollItems = [];
    scroller.addItems();
    scroller._update();

     

    • Like 2
  7. You can put callbacks inside the stagger object.

     

     

    gsap.to(elements, {
      x: 100,
      repeat: -1,
      stagger: {
        each: 0.1,
        onComplete() {
          console.log(this.targets()[0]); // <= the current target
        }
      }
    })

     

    • Like 5
  8. 6 minutes ago, Mazlum Tanrıkulu said:

    I try to change the path of gsap to 

    
    "node_modules/gsap/dist/gsap.min.js"

    in angular.json and it is working I suppose

     

    You're importing gsap twice. Either use the import syntax in every file that uses gsap, or add the script to your angular.json file, but not both.

     

    When using the import syntax, you only need to import gsap though. There is no need to import TweenLite/Max, TimelineLite/Max, or any of the eases.

    import { gsap } from "gsap";

    https://greensock.com/docs/v3/Installation

     

    Eases can be done with strings.

    gsap.to(element, { duration: 2.5, ease: "bounce.out", y: -500 });

    https://greensock.com/docs/v3/Eases

     

    And you most certainly don't need jQuery.

    import { gsap } from "gsap";
    
    gsap.fromTo(".mobile-screen", {
      marginLeft: "20vw"
    }, {
      duration: 0.3,
      marginLeft: "100vw"
    });

     

    👆 animating margins is slow. It would be much better to animate x.  And with angular, you really should be using refs instead selector strings.

    https://www.techiediaries.com/angular-elementref/

     

    • Like 6
  9. 2 hours ago, andystent said:

    You'll see in the Pen that when each block comes into view it has a class added "is-inview". It would be great if I could just have an animation play as soon as that class is added, and then reverse when that class is removed.

     

    You should probably read through their docs. It says there are events, which you should be able to use to control gsap animations.

    https://github.com/locomotivemtl/locomotive-scroll

     

     

    • Like 6
  10. 1 minute ago, Shrug ¯\_(ツ)_/¯ said:

    I was assuming the OP was talking about creating an actual video file. So thats why I was wondering what the process was given resolution etc., come into play.

     

    Yeah, a video is basically the same process I did above for the animated gif. Can't really make a video in a codepen-like environment. The resolution is whatever size you make the images/frames. 

    • Like 1
  11. 1 minute ago, PointC said:

    Anyway, I thought I was about to read a detailed analysis and review of every possible canvas library plus a bunch of cool demos. All I got was one sentence. :D

     

    Hehe. Well, the question was about converting a canvas animation to video, so I don't think it should really matter as long as it looks like what you want.

     

    I mean, you can definitely make cooler effects with WebGL (PixiJs and Three.js), but they don't really do native text. It's drawn on a regular canvas first. And the animation descriptions in the OP seemed pretty basic, fade, typewriter effect, etc, which shouldn't be hard to do with a normal canvas library like fabric.

     

     

    • Like 2
  12. If you need an animation to be synced to the audio, then it might work out better if you manually set the progress of an animation to the progress of the audio.

     

    With a paused animation, something like this on every tick/update.

    myAnimation.progress(audioProgress);

     

    • Like 3
×
×
  • Create New...