Jump to content
Search Community

How to use and import Observer

Ramzdam test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

One of the answer I found in the forum while searching for the animation I like is to use Observer. Now I don't know how to start or where to begin specially with importing it. I tried 

import { Observer } from "gsap/Observer";
gsap.registerPlugin(Observer);

but it says that its not defined or can't find the class Observer. How do I use this? I saw one post saying I need to use Reactjs or start looking for React. But we are not using Reactjs. We are only using Drupal Twig Template and simple HTML. How can I use this plugin? Can someone share any useful link I can follow? 

 

Thanks in advance

See the Pen XWzRraJ by GreenSock (@GreenSock) on CodePen

  • Like 1
Link to comment
Share on other sites

  • Solution

Hi Ramzdam, 

 

59 minutes ago, Ramzdam said:

I saw one post saying I need to use Reactjs or start looking for React.

 

Please don't do that. You do not need React.

 

If you're using modules, then you should do the import thing, otherwise just a <script> tag.

 

https://greensock.com/docs/v3/Installation?checked=core,observer

 

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/Observer.min.js"></script>

 

  • Like 2
Link to comment
Share on other sites

18 minutes ago, OSUblake said:

Hi Ramzdam, 

 

 

Please don't do that. You do not need React.

 

If you're using modules, then you should do the import thing, otherwise just a <script> tag.

 

https://greensock.com/docs/v3/Installation?checked=core,observer

 

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/gsap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.10.4/Observer.min.js"></script>

 

Thanks for this. Just found out that I'm using version 3.9 while Observer is introduced in 3.10

  • Like 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...