Skip to main content

Bug Tracker

Side navigation

#7327 closed enhancement (wontfix)

Opened October 27, 2010 01:10PM UTC

Closed June 07, 2011 06:53PM UTC

Last modified March 10, 2012 02:30AM UTC

jQuery animate passes fixed firstNum, diff to easing function

Reported by: tomalec Owned by:
Priority: low Milestone: 1.7
Component: effects Version: 1.4.3
Keywords: easing,firstnum,1.7-discuss Cc:
Blocked by: Blocking:
Description

jQuery.animete uses easing function with firstNum, diff always set to 0,1:

this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);
this.now = this.start + ((this.end - this.start) * this.pos);

So these parameters are completely useless for easing functions; for example:

swing: function( p, n, firstNum, diff ) {
			return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;
		}
}}

Could be changed to:

swing: function( p, n ) {
			return ((-Math.cos(p*Math.PI)/2) + 0.5);
		}
}}

I suggest changing it to:

this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, this.start, this.end - this.start , this.options.duration);
this.now = this.pos;
Attachments (0)
Change History (13)

Changed October 27, 2010 04:38PM UTC by SlexAxton comment:1

component: unfiledeffects
keywords: → easing firstnum
priority: undecidedlow
status: newopen
type: bugenhancement

Changed April 16, 2011 11:59PM UTC by john comment:2

milestone: → 1.next

Let's look at this for 1.7.

Changed May 22, 2011 07:27PM UTC by john comment:3

keywords: easing firstnumeasing,firstnum,1.7-discuss

Nominating ticket for 1.7 discussion.

Changed May 22, 2011 09:38PM UTC by rwaldron comment:4

description: jQuery.animete uses easing function with firstNum, diff always set to 0,1: \ \ {{{ \ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); \ this.now = this.start + ((this.end - this.start) * this.pos); \ }}} \ So these parameters are completely useless for easing functions; for example: \ {{{ \ swing: function( p, n, firstNum, diff ) { \ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; \ } \ }} \ }}} \ Could be changed to: \ {{{ \ swing: function( p, n ) { \ return ((-Math.cos(p*Math.PI)/2) + 0.5); \ } \ }} \ }}} \ \ \ I suggest changing it to: \ {{{ \ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, this.start, this.end - this.start , this.options.duration); \ this.now = this.pos; \ }}}jQuery.animete uses easing function with firstNum, diff always set to 0,1:\ \ {{{\ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);\ this.now = this.start + ((this.end - this.start) * this.pos);\ }}}\ So these parameters are completely useless for easing functions; for example:\ {{{\ swing: function( p, n, firstNum, diff ) {\ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;\ }\ }}\ }}}\ Could be changed to:\ {{{\ swing: function( p, n ) {\ return ((-Math.cos(p*Math.PI)/2) + 0.5);\ }\ }}\ }}}\ \ \ I suggest changing it to:\ {{{\ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, this.start, this.end - this.start , this.options.duration);\ this.now = this.pos;\ }}}

+0,

Changed May 23, 2011 12:18AM UTC by jaubourg comment:5

-1, This will break plugins defining their own easing methods since it changes the scale of the arguments if I understand correctly

Changed May 23, 2011 03:56AM UTC by timmywil comment:6

-1, customizing swing is valid

Changed June 03, 2011 01:41PM UTC by john comment:7

+0, So yeah, it's not terribly useful in its current state - but making this change will break API, which is... quite bad.

Changed June 03, 2011 03:34PM UTC by scottgonzalez comment:8

-1, this is like fixing .each(), it'd be a better API, but break all existing code

Changed June 04, 2011 10:17PM UTC by addyosmani comment:9

-1

Changed June 05, 2011 08:54PM UTC by ajpiano comment:10

description: jQuery.animete uses easing function with firstNum, diff always set to 0,1:\ \ {{{\ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);\ this.now = this.start + ((this.end - this.start) * this.pos);\ }}}\ So these parameters are completely useless for easing functions; for example:\ {{{\ swing: function( p, n, firstNum, diff ) {\ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;\ }\ }}\ }}}\ Could be changed to:\ {{{\ swing: function( p, n ) {\ return ((-Math.cos(p*Math.PI)/2) + 0.5);\ }\ }}\ }}}\ \ \ I suggest changing it to:\ {{{\ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, this.start, this.end - this.start , this.options.duration);\ this.now = this.pos;\ }}}jQuery.animete uses easing function with firstNum, diff always set to 0,1: \ \ {{{ \ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); \ this.now = this.start + ((this.end - this.start) * this.pos); \ }}} \ So these parameters are completely useless for easing functions; for example: \ {{{ \ swing: function( p, n, firstNum, diff ) { \ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; \ } \ }} \ }}} \ Could be changed to: \ {{{ \ swing: function( p, n ) { \ return ((-Math.cos(p*Math.PI)/2) + 0.5); \ } \ }} \ }}} \ \ \ I suggest changing it to: \ {{{ \ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, this.start, this.end - this.start , this.options.duration); \ this.now = this.pos; \ }}}

-1, Seems like an unwise thing to break

Changed June 05, 2011 09:17PM UTC by tomalec comment:11

Replying to [comment:7 john]:

Break API? In my opinion it will fix the API, since real first number and difference can be different that 0 and 1. But for sure it can break things that uses this variables and assumes that they are static 0, 1 (which is also quite bad)

Replying to [comment:20 ajpiano]:

So maybe make firstNum and diff represent first number and difference, not the 0, and 1?

Changed June 06, 2011 03:59PM UTC by jzaefferer comment:12

description: jQuery.animete uses easing function with firstNum, diff always set to 0,1: \ \ {{{ \ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration); \ this.now = this.start + ((this.end - this.start) * this.pos); \ }}} \ So these parameters are completely useless for easing functions; for example: \ {{{ \ swing: function( p, n, firstNum, diff ) { \ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; \ } \ }} \ }}} \ Could be changed to: \ {{{ \ swing: function( p, n ) { \ return ((-Math.cos(p*Math.PI)/2) + 0.5); \ } \ }} \ }}} \ \ \ I suggest changing it to: \ {{{ \ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, this.start, this.end - this.start , this.options.duration); \ this.now = this.pos; \ }}}jQuery.animete uses easing function with firstNum, diff always set to 0,1:\ \ {{{\ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, 0, 1, this.options.duration);\ this.now = this.start + ((this.end - this.start) * this.pos);\ }}}\ So these parameters are completely useless for easing functions; for example:\ {{{\ swing: function( p, n, firstNum, diff ) {\ return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum;\ }\ }}\ }}}\ Could be changed to:\ {{{\ swing: function( p, n ) {\ return ((-Math.cos(p*Math.PI)/2) + 0.5);\ }\ }}\ }}}\ \ \ I suggest changing it to:\ {{{\ this.pos = jQuery.easing[specialEasing || defaultEasing](this.state, n, this.start, this.end - this.start , this.options.duration);\ this.now = this.pos;\ }}}

-1

Changed June 07, 2011 06:53PM UTC by rwaldron comment:13

milestone: 1.next1.7
resolution: → wontfix
status: openclosed

Closing per 1.7 roadmap meeting resolution