|
23 | 23 | height = 100; |
24 | 24 | $.each($.easing, function(name, impl) { |
25 | 25 | // skip linera/jswing and any non functioning implementation |
26 | | - if (!$.isFunction(impl) || /linear|jswing/.test(name)) |
| 26 | + if (!$.isFunction(impl) || /jswing/.test(name)) |
27 | 27 | return; |
28 | 28 | var graph = $("<div/>").addClass("graph").appendTo("#graphs"); |
29 | 29 | var text = $("<div/>").text(++i + ". " + name).appendTo(graph); |
30 | 30 |
|
31 | 31 | var canvas = $("<canvas/>").appendTo(graph)[0] |
32 | 32 | canvas.width = width; |
33 | 33 | canvas.height = height; |
34 | | - var drawHeight = height * 0.75; |
| 34 | + var drawHeight = height * 0.8; |
35 | 35 | var cradius = 10; |
36 | 36 | var ctx = canvas.getContext("2d"); |
37 | 37 | ctx.fillStyle = "black"; |
|
49 | 49 |
|
50 | 50 | ctx.strokeStyle = "#555"; |
51 | 51 | ctx.beginPath(); |
52 | | - ctx.moveTo(0, drawHeight + .5); |
53 | | - ctx.lineTo(width, drawHeight + .5); |
| 52 | + ctx.moveTo(width * 0.1, drawHeight + .5); |
| 53 | + ctx.lineTo(width * 0.9, drawHeight + .5); |
| 54 | + ctx.stroke(); |
| 55 | + |
| 56 | + ctx.strokeStyle = "#555"; |
| 57 | + ctx.beginPath(); |
| 58 | + ctx.moveTo(width * 0.1, drawHeight * .3 - .5); |
| 59 | + ctx.lineTo(width * 0.9, drawHeight * .3 - .5); |
54 | 60 | ctx.stroke(); |
55 | 61 |
|
56 | 62 | ctx.strokeStyle = "white"; |
57 | 63 | ctx.lineWidth = 2; |
58 | 64 | ctx.beginPath(); |
59 | 65 | $.each(new Array(width), function(position) { |
60 | | - ctx.lineTo(position, drawHeight - position * impl(0, position, 0, 1, height) * 0.75); |
| 66 | + var val = impl(0, position, 0, 1, height); |
| 67 | + if (/linear|jswing/.test(name)) val = position / width; |
| 68 | + ctx.lineTo(position * 0.8 + width * 0.1, drawHeight - drawHeight * val * 0.7); |
61 | 69 | }); |
62 | 70 | ctx.stroke(); |
63 | 71 | graph.click(function() { |
64 | | - $(canvas).animate({height: "hide"}, "slow", name).animate({"left": "0"}, 800).animate({height: "show"}, "slow", name); |
| 72 | + $(canvas).animate({height: "hide"}, 2000, name).animate({"left": "0"}, 800).animate({height: "show"}, 2000, name); |
65 | 73 | }); |
66 | 74 |
|
67 | 75 | graph.width(width).height(height + text.height() + 10); |
|
0 commit comments