Giter Club home page Giter Club logo

Comments (5)

legomushroom avatar legomushroom commented on April 28, 2024 3

@sharathdaniel not yet. We have decided to stick with separate isLoop: true property in this thread #78 so will add it shortly.

Right now you can make the loop that @ingomc suggests in the previous comment - the main idea is to hit .replay() in onComplete callback. The .tune() and .generate() methods might be confusing so there is simplified version:

var burst = new mojs.Burst({
    radius:   { 0: 50 },
    count:    5
    onComplete () { this.replay(); } // <-------
});

burst.play();

from mojs.

legomushroom avatar legomushroom commented on April 28, 2024 2

@sharathdaniel unfortunately nope, mojs don't support infinite loops for now. I think that's the only pitfall of the current tween engine implementation. I can probably add isInfinitePlayback option which will circuit callbacks like this under the hood:

const tween = new mojs.Tween({
   onComplete () { tween.replay(); }
});

There is the pen sample.

But not sure if you want exactly this behavior because it will show up as tween that repeats only once when inside a timeline. I think I got the idea how to implement the infinite loop while was writing this comment actually :) Will try to implement shortly, meanwhile if you need an infinite loop when the tween is in actual playback state ( not controlled by parent timeline ) - the callbacks circuit may be an option for you. // cc @cousine

from mojs.

legomushroom avatar legomushroom commented on April 28, 2024

Hey @cousine!

Nope, currently mojs doesn't support that unfortunately.
But will probably will add the enhancement shortly.

from mojs.

sharathdaniel avatar sharathdaniel commented on April 28, 2024

Hi,
Any update on this?

from mojs.

ingomc avatar ingomc commented on April 28, 2024

It is possible, and it's easy, if you have Random Values, try something with/without .generate().

You can watch my Demo HERE on Codepen, or see the Code below

var circle = new mojs.Burst({
    radius:   { 0: 800 },
    count:    20,
    children: {
        shape:      'polygon',
        points:     3,
        scale: {'rand(1, 6)': 0 },
        fill:       { 'red' : 'pink' },
        angle:      {'rand(0, 360)': 'rand(0, 360)'} ,
        duration:   'rand(3000, 7000)',
        delay:      'rand(0, 10000)'
    },
    onComplete () {
        this.generate().replay();
    }
});

circle.tune().play();

from mojs.

Related Issues (20)

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.