question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for CSS custom property

See original GitHub issue

Currently, there is no way I can animate CSS custom property with anime.js.

div {
  --progress: 100%;
  transform: scale(var(--progress));
}

You can use this to set CSS custom property:

el.style.setProperty('--progress', '40%')

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:9
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
LukeTOBriencommented, Aug 16, 2020

Hi,

I was just searching for this very thing and I came across this post, I this this would be an awesome feature.
I am using Anime in my app and it works really well.

Note: it’s common to define vars in the pseudoclass :root.

Vars can be defined in any element, I am using mine in SVG to set the fill colour, I have frame and I want to animate from one colour to the next. eg:

anime({
  targets: 'svg path',
  '--fill-colour': [
    { value: 'blue', duration: 1000, delay: 500 },
    { value: 'red', duration: 1000, delay: 500 }
  ],
  easing: 'easeOutElastic(1, .8)',
  loop: true
});
5reactions
juliangarniercommented, Jan 9, 2019

Interesting idea, will look a the feasibility later.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS Variables (Custom Properties) | Can I use... Support ...
CSS Variables (Custom Properties). - CR. Permits the declaration and usage of cascading variables in stylesheets. Usage % of. all users, all tracked ......
Read more >
Using CSS custom properties (variables) - MDN Web Docs
Custom properties (sometimes referred to as CSS variables or cascading variables) are entities defined by CSS authors that contain specific ...
Read more >
A Strategy Guide To CSS Custom Properties
Custom properties have the same rules about where they can be used as normal CSS properties. It's far better to think of them...
Read more >
A Complete Guide to Custom Properties | CSS-Tricks
A custom property is most commonly thought of as a variable in CSS. ... Any property that supports multiple comma-separated values might be ......
Read more >
Browser Compatibility of CSS Variables (Custom Properties)
CSS Variables (Custom Properties) on Chrome is fully supported on 49-106, partially supported on None of the versions, and not supported on 4-48 ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found