GithubHelp home page GithubHelp logo

Comments (2)

camille-hdl avatar camille-hdl commented on June 14, 2024

Hi,

this is definitely an interesting proposal.

Your ID system could do the trick but maybe we could instead add a higher lever function animatePaper.sequence(), which would be more flexible.
A sequence being a collection of animations, similar to animatePaper.animate([]) but with more options such as repeat, callbacks, etc.
The API would be something like:

const mySequence = animatePaper.sequence({
      repeat: 2,
      complete: () => { /*...*/},
      steps: [ /* animations */ ]
});
mySequence.run(item);

And, to achieve your fadeIn/pulse/fadeOut combo, the idea would be to nest sequences:

const pulseSequence = animatePaper.sequence({
    repeat: 2,
    steps: [
        {
        properties: {
            scale: 1.5,
        },
        settings: {
            duration: 100
        }
    },
    {
        properties: {
            scale: 1,
        },
        settings: {
            duration: 900
        }
    }
    ]
});
const mySequence = animatePaper.sequence({
    complete: () => { console.log('sequence complete'); },
    steps: [
    { // animation
        {
        properties: {
            opacity: 1,
        },
        settings: {
            duration: 500,
        }
    },
    pulseSequence, // nested sequence
    // ... fadeOut animation ...
    ]
});
mySequence.run(item);

Kind of an enhanced version of the effects API.
What do you think ?

from animatepaper.js.

s-light avatar s-light commented on June 14, 2024

Hi your sequence idea is cool :-)
i have done something 'similar' to allow animation of multiple objects at once with the MultiAnimation Class
Usage example at: animation_arrows.js#L187
usage of svg/json auto-import
live example with svg/json auto-import (hit space to toggle)

i also like the nested sequence idea that is by fare the flexible solution..
what do you think about the next() function to skip/switch to the next sequence step?

from animatepaper.js.

Related Issues (16)

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.