Jump to content

PixiJS Wave Effect


ReaperGermany
 Share

Recommended Posts

9 minutes ago, Dergachev Mihail said:

https://pixijs.io/examples/#/filters-basic/displacement-map-flag.js

Я думаю, что этот пример может удовлетворить все ваши потребности. Используется текстура облака, в вашем примере простой серый градиент.

Вы можете управлять анимацией с помощью этих значений
displacementFilter.scale.x = 30;
displacementFilter.scale.y = 60;

Yes, I thought the same. I tried to apply it with infynity execution, as in the example, but on the site a wave effect begins of the hover and after the hovering ends the animation continues to finish its movement.

Edited by ReaperGermany
Link to comment
Share on other sites

in example:
app.ticker.add(functionWhichEvaluateEveryFrame)

you can use this function to run and stop animation. when mouse over element - just change variable values.

Here is some pseudo code, I hope it should work :)

progress = 30; // nothing happen
mouseEventFired() {
  animationStart = true;
  progress = 0;
}

animate(delta) {
  if (animationStart && progress < 30) {
    displacement.scale.x = 30 - progress;
    progress += 1 * delta;
  } else {
    progress = 30;
  }
}

 

Link to comment
Share on other sites

1 hour ago, Dergachev Mihail said:

in example:
app.ticker.add(functionWhichEvaluateEveryFrame)

you can use this function to run and stop animation. when mouse over element - just change variable values.

Here is some pseudo code, I hope it should work :)

progress = 30; // nothing happen
mouseEventFired() {
  animationStart = true;
  progress = 0;
}

animate(delta) {
  if (animationStart && progress < 30) {
    displacement.scale.x = 30 - progress;
    progress += 1 * delta;
  } else {
    progress = 30;
  }
}

 


thank you very much, but  :( the wrong effect comes out

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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