Side navigation
#8498 closed feature (fixed)
Opened March 10, 2011 10:05PM UTC
Closed December 09, 2011 01:07AM UTC
Last modified March 09, 2012 04:18PM UTC
Animate Hooks
Reported by: | gnarf | Owned by: | gnarf |
---|---|---|---|
Priority: | blocker | Milestone: | 1.7.2 |
Component: | effects | Version: | 1.5.1 |
Keywords: | Cc: | scottgonzalez | |
Blocked by: | Blocking: |
Description
A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/
I propose that we should add a pre-filter to the properties animated in
.animate()that would allow us to convert
a call like
.animate({margin: 40})into
.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40})automatically.
Attachments (0)
Change History (19)
Changed March 10, 2011 10:29PM UTC by comment:1
cc: | → scott.gonzalez |
---|
Changed March 14, 2011 02:45PM UTC by comment:2
component: | unfiled → effects |
---|---|
priority: | undecided → low |
status: | new → open |
Changed March 14, 2011 02:45PM UTC by comment:3
owner: | → gnarf |
---|---|
status: | open → assigned |
Changed April 17, 2011 05:11PM UTC by comment:4
summary: | Animating the "margin" "padding" or other similar properties can cause bad "flashes" → Animate Hooks |
---|---|
type: | bug → feature |
I'm mutating this bug into a new feature request - where we add in a set of hooks for doing animations.
Changed May 22, 2011 07:27PM UTC by comment:5
keywords: | → 1.7-discuss |
---|
Nominating ticket for 1.7 discussion.
Changed May 22, 2011 09:30PM UTC by comment:6
description: | A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/ \ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert \ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically. \ → A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/\ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert\ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically.\ |
---|
+1, In support of, pending #9401
Changed May 23, 2011 12:33AM UTC by comment:7
-1, sounds reasonable to me... but wouldn't making cssHooks more "open" (that is being able to return the redefinition if needed by a third-party like effects.js) solve the issue? I hate the idea of css related stuff hidden into effects.js.
Changed May 23, 2011 12:38AM UTC by comment:8
_comment0: | well Julian - Yeah, I kinda agree that the {{{animateHooks}}} might not be the best implementation -- likely we could make it like: \ \ {{{ \ $.cssHooks.margin = { \ map: function( value ) { \ return { \ marginLeft: value, //....etc.... \ }; \ }; \ }}} \ And then soup up .css and .animate to read from the hooks looking for a "map" when they are doing their property mangling stuff i.e. camelCase. \ \ My reasoning for taking the approach is that when you do {{{ .css("margin", 10); }}} you could actually skip "mapping" the values, because the browser already does it for you, there isn't a ton of reason to have the "map" unless you are doing a per-property based animation.... \ \ Does the other approach get a more favorable vote in your eyes? → 1306111175258437 |
---|---|
_comment1: | well Julian - Yeah, I kinda agree that the {{{animateHooks}}} might not be the best implementation -- likely we could make it like: \ \ {{{ \ $.cssHooks.margin = { \ map: function( value ) { \ return { \ marginLeft: value, \ marginRight: value, \ marginTop: value, \ marginBottom: value, \ }; \ } \ }; \ }}} \ And then soup up .css and .animate to read from the hooks looking for a "map" when they are doing their property mangling stuff i.e. camelCase. \ \ My reasoning for taking the approach is that when you do {{{ .css("margin", 10); }}} you could actually skip "mapping" the values, because the browser already does it for you, there isn't a ton of reason to have the "map" unless you are doing a per-property based animation.... \ \ Does the other approach get a more favorable vote in your eyes? → 1306111203994241 |
_comment2: | well Julian - Yeah, I kinda agree that the {{{animateHooks}}} might not be the best implementation -- likely we could make it like: \ \ {{{ \ $.cssHooks.margin = { \ map: function( value ) { \ return { \ marginLeft: value, \ marginRight: value, \ marginTop: value, \ marginBottom: value, \ }; \ } \ }; \ }}} \ And then soup up .css and .animate to read from the hooks looking for a "map" when they are doing their property mangling stuff i.e. camelCase. \ \ My reasoning for taking the approach I did is that when you do {{{ .css("margin", 10); }}} you could actually skip "mapping" the values, because the browser already does it for you, there isn't a ton of reason to have the "map" unless you are doing a per-property based animation.... \ \ Does the other approach get a more favorable vote in your eyes? → 1306111240056985 |
description: | A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/\ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert\ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically.\ → A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/ \ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert \ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically. \ |
well Julian - Yeah, I kinda agree that the
animateHooksmight not be the best implementation -- likely we could make it like:
$.cssHooks.margin = { map: function( value ) { return { marginLeft: value, marginRight: value, marginTop: value, marginBottom: value }; } };
And then soup up .css and .animate to read from the hooks looking for a "map" when they are doing their property mangling stuff i.e. camelCase.
My reasoning for taking the approach I did is that when you do
.css("margin", 10);you could actually skip "mapping" the values, because the browser already does it for you, there isn't a ton of reason to have the "map" unless you are doing a per-property based animation....
Does the other approach get a more favorable vote in your eyes?
Changed May 23, 2011 04:22AM UTC by comment:9
description: | A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/ \ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert \ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically. \ → A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/\ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert\ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically.\ |
---|
+1, Yes, I think some stuff should be in effects.js
Changed May 24, 2011 09:18PM UTC by comment:10
description: | A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/\ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert\ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically.\ → A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/ \ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert \ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically. \ |
---|
-1, I have concerns about size if all these strings are going into the source -- is there some other solution? Maybe a plugin would be best for non-trivial animation enhancements.
Changed June 03, 2011 01:49PM UTC by comment:11
description: | A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/ \ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert \ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically. \ → A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/\ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert\ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically.\ |
---|
+1, Only if we're talking about adding a map to cssHooks (and not necessarily adding in those properties ourselves).
Changed June 04, 2011 10:16PM UTC by comment:12
+1
Changed June 05, 2011 09:22PM UTC by comment:13
description: | A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/\ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert\ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically.\ → A quick fiddle to demonstrate: http://jsfiddle.net/gnarf/9muvX/ \ \ I propose that we should add a pre-filter to the properties animated in {{{.animate()}}} that would allow us to convert \ a call like {{{.animate({margin: 40})}}} into {{{.animate({marginLeft: 40, marginRight: 40, marginBottom: 40, marginTop: 40}) }}} automatically. \ |
---|
+1, I like the idea of just using cssHooks from within .animate
Changed June 07, 2011 11:32PM UTC by comment:14
If we are looking towards supporting animations like margin: 30px 40px, I've worked out a regex for it for fun:
/(-?\\d+)(?:px)?(?:\\s+(-?\\d+)(?:px)?)?(?:\\s+(-?\\d+)(?:px)?)?(?:\\s+(-?\\d+)(?:px)?)?/
xoxo
Changed July 12, 2011 03:02PM UTC by comment:15
milestone: | 1.next → 1.7 |
---|---|
priority: | low → blocker |
Changed September 18, 2011 08:24AM UTC by comment:16
Changed October 10, 2011 04:17PM UTC by comment:17
keywords: | 1.7-discuss → 1.8-discuss |
---|---|
milestone: | 1.7 → 1.8 |
Changed December 09, 2011 01:07AM UTC by comment:18
resolution: | → fixed |
---|---|
status: | assigned → closed |
Fix #8498. Add cssHooks[prop].expand for use by animate().
Changeset: 8f5f1b2e6c0f7b8b6d66bfc06c7b169a9443c2b8
Changed December 10, 2011 06:40PM UTC by comment:19
keywords: | 1.8-discuss |
---|---|
milestone: | 1.8 → 1.7.2 |