-
Notifications
You must be signed in to change notification settings - Fork 23
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
Rework macros to be used as static tram properties. #1
Comments
@weotch check out the above spec ^ .. does that work for your auto-hide request? tram also now has a show() shortcut as well. so you can do this: tram(element).show().start({ etc }) |
In your |
@weotch of course, man ;) every start() is actually deferred a single animation frame. hide() is also smart in that it stops the tram before setting display: none. |
Here's a test showing how tram works with display: none. http://bkwld.github.io/tram/test/display-none.html |
Was thinking of finally making some macros. Is the API for them gonna change you think? |
@weotch currently there are no macros... we'd need to define how that works. |
Exactly. I do like the idea of the |
Regarding defining how it works, what about an API like: // Define it. `tram` is the AMD module
tram.macro('fadeOut', function() { this.add('opacity 300ms').start({opacity:0}).then(function() { this.hide(); }); });
// Use it
$el.tram().macro('fadeOut'); Note: I edited this |
Been thinking more about macros, and I don't think we need to write any code to support them. Tram already supports passing functions to the tram(el, fadeOut(800));
function fadeOut(time) {
if (time == null) time = 500;
return function () {
this
.add('opacity ' + time)
.start({ opacity: 0 })
.then(function () {
this.hide();
});
};
} Working jsbin example here. |
Macros should be reworked a bit.
Instead of strings, I think they'd be more useful like this:
or
The text was updated successfully, but these errors were encountered: