1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
5 <title>visualising dojo._Animation.easing via dojox.charting</title>
7 <link rel="stylesheet" type="text/css" media="screen"
8 href="../../../dojo/resources/dojo.css">
10 <link rel="stylesheet" type="text/css" media="screen"
11 href="../../../dijit/themes/tundra/tundra.css">
13 <style type="text/css">
15 border:1px solid #b7b7b7;
16 -moz-border-radius:8pt;
20 <script type="text/javascript" djConfig="isDebug:false, parseOnLoad: true"
21 src="../../../dojo/dojo.js"></script>
23 <script type="text/javascript">
24 // one simple theme, and the charting engine:
25 dojo.require("dojox.charting.Chart2D");
26 // and easing functions:
27 dojo.require("dojox.fx.easing");
31 var makeSeries = function(/* string */str, /* Function */ func){
32 // make some data by running a 2sec animation with an easing function
33 // and adding it to the chart
35 if(str in masterData){
36 seriesData=masterData[str];
39 if(!seriesData.length){
40 var func = func || dojox.fx.easing[str];
41 func = (dojo.isFunction(func) ? func : dojo._defaultEasing);
43 for(var i=0; i<=120; i++){
45 seriesData.push({ y: 30 * func(pct), x: (pct) * 30});
47 if(!str.match(/^dynSeries/)){
48 masterData[str] = seriesData;
52 { stroke: { color: "black", width: 0 }, fill: "rgba(30,0,255,0.10)" }
55 chart.updateSeries(str, seriesData).render();
59 var removeSeries = function(str){
60 chart.updateSeries(str, []);
61 if(!clearAll){ chart.render(); }
64 var toggleChart = function(widget, str){
76 dojo.addOnLoad(function(){
79 chart = new dojox.charting.Chart2D("easingChart");
96 chart.addPlot("default", {type: "Areas"});
100 dojo.addOnLoad(function(){
102 var c = dojo.query(".clone")[0];
103 opt = dojo.byId("select");
105 for(var i in dojox.fx.easing){
106 var n = opt.appendChild(dojo.clone(c));
107 n.value = n.innerHTML = i
111 dojo.connect(opt,"onchange",function(e){
112 dojo.query("option",opt)
113 // we only want "selected" nodes
114 .filter(function(n){ return n.selected; })
115 // yay, here they are:
116 .forEach(function(n){
119 makeSeries(opt.value,dojox.fx.easing[opt.value]);
122 dojo.query(".box").connect("onclick",function(e){
123 console.log(opt.value,dojox.fx.easing[opt.value]);
126 makeSeries("visible",dojo._defaultEasing);
132 <body class="tundra" style="padding:20px">
134 <h1>dojox.fx.easing</h1>
136 <p>this chart shows time (x axis) vs. position (y axis) for a movement from 0px to 30px modified by easing functions</p>
138 <select id="select" multiple="true" size="7" name="easing">
139 <option class="clone" value="dojo._defaultEasing">dojo._defaultEasing</option>
143 <div id="easingChart" style="height:300px"></div>