Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
93fdbeb9
Commit
93fdbeb9
authored
Dec 06, 2009
by
James Padolsey
Committed by
John Resig
Dec 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for per-property easing
parent
62a34450
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
1 deletion
+42
-1
fx.js
src/fx.js
+8
-1
fx.js
test/unit/fx.js
+34
-0
No files found.
src/fx.js
View file @
93fdbeb9
...
@@ -128,6 +128,11 @@ jQuery.fn.extend({
...
@@ -128,6 +128,11 @@ jQuery.fn.extend({
// Make sure that nothing sneaks out
// Make sure that nothing sneaks out
opt
.
overflow
=
this
.
style
.
overflow
;
opt
.
overflow
=
this
.
style
.
overflow
;
}
}
if
(
jQuery
.
isArray
(
prop
[
p
]
)
)
{
// Create (if needed) and add to specialEasing
(
opt
.
specialEasing
=
opt
.
specialEasing
||
{})[
p
]
=
prop
[
p
][
1
];
prop
[
p
]
=
prop
[
p
][
0
];
}
}
}
if
(
opt
.
overflow
!=
null
)
{
if
(
opt
.
overflow
!=
null
)
{
...
@@ -387,7 +392,9 @@ jQuery.fx.prototype = {
...
@@ -387,7 +392,9 @@ jQuery.fx.prototype = {
this
.
state
=
n
/
this
.
options
.
duration
;
this
.
state
=
n
/
this
.
options
.
duration
;
// Perform the easing function, defaults to swing
// Perform the easing function, defaults to swing
this
.
pos
=
jQuery
.
easing
[
this
.
options
.
easing
||
(
jQuery
.
easing
.
swing
?
"swing"
:
"linear"
)](
this
.
state
,
n
,
0
,
1
,
this
.
options
.
duration
);
var
specialEasing
=
this
.
options
.
specialEasing
&&
this
.
options
.
specialEasing
[
this
.
prop
];
var
defaultEasing
=
this
.
options
.
easing
||
(
jQuery
.
easing
.
swing
?
"swing"
:
"linear"
);
this
.
pos
=
jQuery
.
easing
[
specialEasing
||
defaultEasing
](
this
.
state
,
n
,
0
,
1
,
this
.
options
.
duration
);
this
.
now
=
this
.
start
+
((
this
.
end
-
this
.
start
)
*
this
.
pos
);
this
.
now
=
this
.
start
+
((
this
.
end
-
this
.
start
)
*
this
.
pos
);
// Perform the next step of the animation
// Perform the next step of the animation
...
...
test/unit/fx.js
View file @
93fdbeb9
...
@@ -586,3 +586,37 @@ test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function ()
...
@@ -586,3 +586,37 @@ test("jQuery.show('fast') doesn't clear radio buttons (bug #1095)", function ()
start
();
start
();
});
});
});
});
test
(
"animate with per-property easing"
,
function
(){
expect
(
3
);
stop
();
var
_test1_called
=
false
;
var
_test2_called
=
false
;
var
_default_test_called
=
false
;
jQuery
.
easing
[
'_test1'
]
=
function
()
{
_test1_called
=
true
;
};
jQuery
.
easing
[
'_test2'
]
=
function
()
{
_test2_called
=
true
;
};
jQuery
.
easing
[
'_default_test'
]
=
function
()
{
_default_test_called
=
true
;
};
jQuery
({
a
:
0
,
b
:
0
,
c
:
0
}).
animate
({
a
:
[
100
,
'_test1'
],
b
:
[
100
,
'_test2'
],
c
:
100
},
400
,
'_default_test'
,
function
(){
start
();
ok
(
_test1_called
,
"Easing function (1) called"
);
ok
(
_test2_called
,
"Easing function (2) called"
);
ok
(
_default_test_called
,
"Easing function (_default) called"
);
});
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment