Jump to content
Search Community

Gsap.to() equals in pure js/css

Ikuro1o test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

Hello, I'm a new user in the world of GSAP. For one reason, I'd like to know for the gsap.to() equals in pure css/ javascript. I's rather to learn the basic properties that gsap.to() uses to animate it. This is an example from Chris Course in Youtube:

 

class Enemy {
    constructor(x,y,rad,color,velocity){
        this.x = x;
        this.y = y;
        this.rad =rad;
        this.color = color;
        this.velocity = velocity;
    }

    create() {
        c.beginPath();
        c.arc(this.x, this.y, this.rad, 0, Math.PI *2, false);
        c.fillStyle = this.color;
        c.fill();
    }

    update() {
        this.create();
        this.x += this.velocity.x;
        this.y += this.velocity.y;
    }
}

//When a bullet reach a big enemy 
gsap.to(Enemy, { rad: Enemy.rad -11 });
//...

Is there any pure css or javascript equal for the gsap.to() in the example? Thank you in advance

Link to comment
Share on other sites

  • Solution

Welcome to the forums @Ikuro1o

 

There's no real CSS equivalent in the example code you just gave as CSS only works with DOM elements. If you'd like to know how GSAP works, I'd suggest checking out some of the Coding Math videos on tweening and easing (episodes 27-31). He even mentions GSAP. 😁

 

https://www.youtube.com/user/codingmath/videos

 

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