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

Create a method to simplify CSS transition boilerplate #92

Open
premasagar opened this issue Oct 10, 2013 · 0 comments
Open

Create a method to simplify CSS transition boilerplate #92

premasagar opened this issue Oct 10, 2013 · 0 comments

Comments

@premasagar
Copy link
Owner

Using CSS transitions of CSS transformations is one of the most reliable and simplest ways to achieve animation. At it's simplest, this kind of thing is currently required:

var body = Pablo('body');
var svg = body.svg({width:500, height:500});
var circle = svg.circle({r:50, cx:50, cy:50});

circle.cssPrefix('transition', 'all 1s ease-in');

window.setTimeout(function(){
    circle.cssPrefix('transform', 'translate(100px, 200px)');
}, 4);

The setTimeout is awkward and could be handled by a method. The use of cssPrefix('transition') could be rolled into cssTransition() method and the use of cssPrefix('transform') into acssTransform()method.allis used in the example because the alternativecssPrefix('transition', Pablo.cssPrefix('transform') is not only ugly but also sometimes unreliable, at least in Chrome, (when exactly would be worth pinning down) - it seems Chrome can ignore a CSS rule when it doesn't recognise some of the comma-separated CSS properties in the transition list.

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