]> source.dussan.org Git - jquery-ui.git/commitdiff
effects: demo visualising easing functions
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 23 Apr 2009 20:55:45 +0000 (20:55 +0000)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Thu, 23 Apr 2009 20:55:45 +0000 (20:55 +0000)
demos/effect/easing.html [new file with mode: 0644]

diff --git a/demos/effect/easing.html b/demos/effect/easing.html
new file mode 100644 (file)
index 0000000..043c4ca
--- /dev/null
@@ -0,0 +1,92 @@
+<!doctype html>\r
+<html lang="en">\r
+<head>\r
+       <title>jQuery UI Effects - Effect Demo</title>\r
+       <link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />\r
+       <script type="text/javascript" src="../../jquery-1.3.2.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.core.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.blind.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.bounce.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.clip.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.drop.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.explode.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.fold.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.highlight.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.pulsate.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.scale.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.shake.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.slide.js"></script>\r
+       <script type="text/javascript" src="../../ui/effects.transfer.js"></script>\r
+       <link type="text/css" href="../demos.css" rel="stylesheet" />\r
+       <style type="text/css">\r
+               .graph {\r
+                       float: left;\r
+                       margin-left: 5px;\r
+                       width: 100px;\r
+                       height: 120px;\r
+               }\r
+               .graph canvas {\r
+                       border: 1px solid black;\r
+                       border-top: none; border-right: none;\r
+               }\r
+       </style>\r
+       <script type="text/javascript">\r
+       $(function() {\r
+               if (!$("<canvas/>")[0].getContext) {\r
+                       $("<div/>").text("Your browser doesn't support canvas, which is required for this demo. Give Firefox 3 a try!").appendTo("#graphs");\r
+                       return;\r
+               }\r
+               var i = 0;\r
+               $.each($.easing, function(name, impl) {\r
+                       if (!$.isFunction(impl))\r
+                               return;\r
+                       var graph = $("<div/>").addClass("graph").appendTo("#graphs");\r
+                       $("<div/>").text(++i + ". " + name).appendTo(graph);\r
+                       var canvas = $("<canvas/>").appendTo(graph)[0]\r
+                       canvas.width = 100;\r
+                       canvas.height = 100;\r
+                       var ctx = canvas.getContext("2d");\r
+                       ctx.fillStyle = "rgb(255, 232, 198)";\r
+                       ctx.fillRect(0, 0, 100, 100);\r
+                       ctx.lineWidth = 1;\r
+                       $.each(new Array(10), function(index) {\r
+                               ctx.beginPath();\r
+                               ctx.moveTo(0, index * 10 + 10.5);\r
+                               ctx.lineTo(4, index * 10 + 10.5);\r
+                               ctx.moveTo(index * 10 + 10.5, 96);\r
+                               ctx.lineTo(index * 10 + 10.5, 100);\r
+                               ctx.stroke();\r
+                       })\r
+                       $.each(new Array(100), function(position) {\r
+                               var mod = impl(0, position, 0, 1, 100);\r
+                               ctx.beginPath();\r
+                               ctx.moveTo(position, 100 - position * mod);\r
+                               ctx.lineTo(position + 1, 99 - position * mod);\r
+                               ctx.stroke();\r
+                       });\r
+                       graph.click(function() {\r
+                               $(canvas).animate({height: "hide"}, "slow", name).animate({height: "show"}, "slow", name);\r
+                       });\r
+                       //return false;\r
+               });\r
+       });\r
+       </script>\r
+</head>\r
+<body>\r
+\r
+<div class="demo">\r
+\r
+       <div id="graphs"></div>\r
+       \r
+       <div id="animted"></div>\r
+\r
+</div><!-- End demo -->\r
+\r
+<div class="demo-description">\r
+\r
+<p>All easings provided by jQuery UI are drawn above. Click a diagram to see the easing in action. "linear" and "jswing" aren't rendered properly, but work, too.</p>\r
+\r
+</div><!-- End demo-description -->\r
+\r
+</body>\r
+</html>\r