Git Product home page Git Product logo

Comments (7)

GoToLoop avatar GoToLoop commented on August 23, 2024

Apparently method resume() can't be invoked when the Ani isEnded().
Maybe replace pause() w/ end() and resume() w/ start()? 💡

from ani.

julsgud avatar julsgud commented on August 23, 2024

You are right! The following works properly. The only downside is that you are are starting with the ended animation, which in some cases may be undesirable. Here is what works, does not throw previous error.

In constructor:

Cirlce() {
    // diameter animation
    diameterAni = new Ani(this, duration, "diameter", diameterEnd);
    diameterAni.end();
  }

Bang method:

void bang() {
    diameter = diameterStart;
    diameterAni.start();
  }

Thanks! The idea of using pause/resume/seek is great though, it helps you prep an Ani in the state that you want. Would be great to see that refactored to be able to restart when a Ani has ended.

from ani.

GoToLoop avatar GoToLoop commented on August 23, 2024

You can always check for isEnded() or isPlaying() before invoking resume(). 🌟

from ani.

b-g avatar b-g commented on August 23, 2024

Hi @julsgud Thanks for the bug report and pointer! I can confirm that this is a bug :( Will try to fix it with the next maintenance update (might take some time), as Ani is no longer heavily under development. P5js is the future! :) Please use in the meantime the workaround of @GoToLoop. Cheers! All the best, Benedikt

from ani.

julsgud avatar julsgud commented on August 23, 2024

Hey @b-g! @GoToLoop 's workaround does the job pretty well! Great to hear you are placing your future bets on p5js. Any plans for an Ani for p5js? Would love to help/support making that happen. Woop! Best, Juls

from ani.

b-g avatar b-g commented on August 23, 2024

Hi @julsgud, Yes I think javascript is one of the main leads for the future of creative coding in terms of technicalities ... However there are so many animation libraries in javascript that I'm not convinced whether it is a good idea / worth the effort to port Ani to JS. Or what do you think?

https://github.com/tweenjs/tween.js/
https://greensock.com/tweenlite
https://github.com/juliangarnier/anime
...

from ani.

julsgud avatar julsgud commented on August 23, 2024

Hey @b-g , I have to say I agree. It also seems that tween.js has a similar approach to Ani declarations, great to have that simplicity there too. Will start doing some tests to see how well they play with p5js. Thanks for sharing these!

from ani.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.