Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
odell

pixi texture animation

Recommended Posts

So theres two things I'm trying to accomplish that I can't seem to figure out. How would i go about changing the "baseSpeed" to 0 when I hover over the button and if I wanted the particles to interact with the cursor either repel or attract how should I go about that.

See the Pen XWmZQJa by trendstar (@trendstar) on CodePen

Link to comment
Share on other sites

1 hour ago, odell said:

How would i go about changing the "baseSpeed" to 0 when I hover over the button

GSAP animates objects, so you could put the speed in an object and animate that object. Something like:

const baseObj = {speed: 0.02};

// Later
gsap.to(baseObj, {speed: 0});

 

1 hour ago, odell said:

if I wanted the particles to interact with the cursor either repel or attract how should I go about that.

You need to calculate the distance from the mouse position to each particle and then implement some logic to animate the particle to or away from that point :) 

  • 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.
×