Jump to content
Search Community

Module Warning (from ./node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader/index.js): error: 'Power0' is not defined (no-undef)

cmm test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

This is a vue js project....  not sure why I'm getting this error?  This seems very straight forward:

Module Warning (from ./node_modules/@vue/cli-plugin-eslint/node_modules/eslint-loader/index.js):
error: 'Power0' is not defined (no-undef) at src/components/global/_base-carousel.vue:47:52:
  45 |     this.observer = new IntersectionObserver(this.moveObject, options)
  46 |     this.slides = document.getElementsByClassName('slide')
> 47 |     TweenLite.to(this.slides, 2, { x: -2500, ease: Power0.easeNone })
     |                                                    ^



import { TweenLite } from 'gsap'

export default {
  name: 'BaseCarousel',
  // components: { Carousel, Slide },
  props: ['content'],
  data () {
    return {
      classes: this.content.entry.classes,
      images: this.content.entry.images,
      animation: this.content.entry.animation,
      observer: {},
      slides: {}
    }
  },
  mounted () {
    // Create a observer
    let options = {
      root: null, // relative to document viewport
      rootMargin: '0px', // margin around root. Values are similar to css property. Unitless values not allowed
      threshold: 1.0 // visible amount of item shown in relation to root
    }
    this.observer = new IntersectionObserver(this.moveObject, options)
    this.slides = document.getElementsByClassName('slide')
    TweenLite.to(this.slides, 2, { x: -2500, ease: Power0.easeNone })
Link to comment
Share on other sites

Looks like maybe you just forgot to import Power0 :)

 

import { TweenLite, Power0 } from "gsap";

But actually, I think you may have meant Linear, since you're referencing easeNone:

 

import { TweenLite, Linear } from "gsap";

TweenLite.to(this.slides, 2, { x: -2500, ease: Linear.easeNone }

Don't forget that if you intend to animate CSS-related values, you'll need CSSPlugin. ?

 

  • Like 2
Link to comment
Share on other sites

Thanks so much for your quick response, that fixed the error.  It would be helpful if we could get dependancies noted in docs....  for example when looking at the docs for easing I didn't see anywhere that loading easing methods was separate for each ease.  Thanks again.

Link to comment
Share on other sites

Why wouldn't I be getting a linear ease... see attachment.

 

TweenLite.to(this.slides, 2, { x: -2500, ease: Linear.easeNone })

I did import the CSSPlugin...

import { TweenLite, Linear, CSSPlugin } from 'gsap'

also added this.... just in case:

// Fix for treeshaking

// eslint-disable-next-line

const plugins = [ TweenLite, Linear, CSSPlugin ]

 

No errors on running.   Thanks

Link to comment
Share on other sites

I found the problem....  removing the transition/transform (transition: transform 4s; &:hover { transform: translateX(-700px); } css on the elements gave me the expected behavior from GS.  Thanks for your help.

 

Has anyone seen an example of how to achieve the horizontal infinite pic scrolling as on this page - https://brand.uber.com/ (scroll down a little)?

  • Like 1
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...