Skip to content

Wrap animations (properties) in a defined key. #689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
infacto opened this issue May 19, 2020 · 1 comment
Open

Wrap animations (properties) in a defined key. #689

infacto opened this issue May 19, 2020 · 1 comment

Comments

@infacto
Copy link

infacto commented May 19, 2020

Currently you just define the animation properties like scale or opacity etc. in the root config object which also contains other not related properties for options like autoplay and targets etc.
This can be a bit dangerous. Because property-name collisions.

Simple example:

var battery = {
  charged: '0%',
  cycles: 120,
  duration: 42
}

anime({
  targets: battery,
  charged: '100%',
  cycles: 130,
  round: 1,
  easing: 'linear'
});

// How to animate "duration" from the battery object without passing the pre-defined props "duration" of Anime?

Maybe not the best example, but collisions with this design is possible.
Should be something like this:

var battery = {
  charged: '0%',
  cycles: 120,
  duration: 42
}

anime({
  targets: '',
  duration: 300,
  round: 1,
  easing: 'linear',
  props: {
    charged: '100%',
    cycles: 130,
    duration: 100
  }
});

"props" or "properties" or "keys" or "animate" or whatever...

Or is this already possible? Wrapping the properties to animate in another scope to prevent collisions with pre-defined options.

animejs@3.2.0

@Ridvanovskyy
Copy link

Looks like that now there is 0 info in console. If lib will migrating to ts - this case will be solve in linting IDE level. But idea with props - nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants