Skip to content
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

Add range notation ("100to200ms", "+=100to200ms", "-=100to200ms") #39

Closed
notoriousb1t opened this issue Oct 18, 2016 · 2 comments
Closed
Assignees

Comments

@notoriousb1t
Copy link
Member

notoriousb1t commented Oct 18, 2016

To all css properties that take a time, distance, or measurement

just.animate({
    css: {
        x: '+=100to200px',
        // x(target, index, targets) {  return index * 100 + just.random(0, 100, 'px') }
    }
})
@notoriousb1t
Copy link
Member Author

notoriousb1t commented Oct 19, 2016

The expression should be

const unitExpression = /^([+-][=]){0,1}[ ]*([\-]{0,1}[0-9]*[\.]{0,1}[0-9]*){0,1}[ ]*(to){0,1}[ ]*([\-]{0,1}[0-9]*[\.]{0,1}[0-9]*)[ ]*([a-z%]+){0,1}[ ]*$/i;

[1] = stepFunction
[2] = startValue (or value if no endValue)
[3] = range operator (the word to)
[4] = endValue
[5] = unit

+=100to200ms would translate to

[1] +=
[2] 100
[3] to
[4] 200
[5] ms

@notoriousb1t
Copy link
Member Author

Added for delays, going to table this otherwise for now

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

No branches or pull requests

1 participant