Files
jquery.easing-mirror/example/verify.html
Brett Zamir e57b1fc7d1 - Fix: Fix CommonJS/AMD export; fixes #30
- Enhancement (demo): Switch to local jquery; closes #29
- License: Rename file to reflect license type and add file extension
- Linting (ESLint): Add linting config and script; enforce recommended rules and indent/semicolon
- Linting (HTML): Use tabs for indent (as with JavaScript); remove redundant type=text/css, type=text/javascript attributes; quote attributes for HTML validator; suppress favicon requests
- Maintenance: Add `.editorconfig` to proactively enforce indent by IDEs
- npm: Add recommended `package-lock.json`
- npm: Add recommended `package.json` properties
- npm: Add static server (and open-cli) for testing and opening example
2020-08-06 18:22:37 +08:00

78 lines
1.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Verify results against Easing 1.3 plugin</title>
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon" />
<script src="../node_modules/jquery/dist/jquery.js"></script>
<script>
/* globals $ */
/* eslint-disable no-unused-vars */
var origEasing = $.extend(true, {}, $.easing);
</script>
<script src="../jquery.easing.js"></script>
<script>
/* globals $ */
var newEasing = $.extend(true, {}, $.easing);
</script>
<!-- loaded last because it refers back to the $.easing fns it defines -->
<script src="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"></script>
<script>
/* globals $ */
var oldEasing = $.easing;
</script>
<style media="screen">
#bounds {
width: 250px;
height: 250px;
border: 1px solid #888;
}
#box {
height: 50px;
width: 50px;
background: black;
}
</style>
<script>
/* globals $ */
$(function() {
var times = [
0, 0.09, 0.15, 0.24, 0.37, 0.43, 0.50,
0.58, 0.64, 0.76, 0.89, 0.92, 0.98, 1
];
$.each( oldEasing, function( name ) {
var oldfn = oldEasing[ name ],
newfn = newEasing[ name ];
if ( typeof oldfn !== "function" || name === "swing" || name === "jswing" ) {
return;
}
$( "#results").append( "<br />--- Testing " + name + " " );
try {
times.forEach( function( time ) {
var ov = oldfn(time, time*1000, 0, 1, 1000),
nv = newfn(time),
diff = Math.abs(ov - nv);
if ( Number.isNaN(diff) || diff > 0.001 ) {
$( "#results").append("<br />at " + time + ": old " + ov + " new " + nv );
}
});
$( "#results").append( "Done" );
} catch ( err ) {
$( "#results").append( err );
}
});
});
</script>
</head>
<body>
<h1>Easing function comparison</h1>
<p id="results"></p>
</body>
</html>