summaryrefslogtreecommitdiffstatshomepage
path: root/includes/js/dojox/fx/tests/test_easing.html
blob: fa7bf410f2e9139a37840ae1208cf9e1dc3d16ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<title>dojox.fx.easing functions:</title>
		
	<script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true, parseOnLoad: true" ></script>
	<style type="text/css">
		@import "../../../dojo/resources/dojo.css";
		@import "../../../dijit/themes/dijit.css";
		@import "../../../dijit/themes/tundra/tundra.css";
		@import "../../../dijit/tests/css/dijitTests.css";

		.bounce {
			position:absolute;
			top:300px;
			left:400px;
			width:25px;
			height:25px;
			border:1px solid #b7b7b7;
			background:#ededed;
		}

		.block {
			width:200px;
			height:100px;
			background:#666;
			border:1px solid #ccc;
			display:block; 
			color:#fff;
			text-align:center; 
		}
	
	</style>
	<script type="text/javascript">
		dojo.require("dojo.fx"); // chain and combine should be in core :) (when they work)
		dojo.require("dojox.fx.easing"); 


		var allAnim = null; 
		dojo.addOnLoad(function(){

		var easeInAnim = dojo.fx.chain([
			dojo.fadeOut({
				node: 'easeIn',
				duration:2000,
				easing: dojox.fx.easing.easeIn
			}),
			dojo.fadeIn({	
				node: 'easeIn',
				duration:2000,
				easing: dojox.fx.easing.easeIn
			})
		]);


		var easeOutAnim = dojo.fx.chain([
			dojo.fadeOut({
				node: 'easeOut',
				duration:2000,
				easing: dojox.fx.easing.easeOut
			}),
			dojo.fadeIn({	
				node: 'easeOut',
				duration:2000,
				easing: dojox.fx.easing.easeOut
			})
		]);

		var easeInOutAnim = dojo.fx.chain([
			dojo.fadeOut({
				node: 'easeInOut',
				duration:2000
			}),
			dojo.fadeIn({	
				node: 'easeInOut',
				duration:2000
			})
		]);

		var linearEaseAnim = dojo.fx.chain([
			dojo.fadeOut({
				node: 'linearEase',
				duration:2000,
				easing: dojox.fx.easing.linear
			}),
			dojo.fadeIn({
				node: 'linearEase',
				duration:2000,
				easing: dojox.fx.easing.linear
			})
		]);

		dojo.connect(dojo.byId('easeIn'),"onclick",easeInAnim,"play");
		dojo.connect(dojo.byId('easeOut'),"onclick",easeOutAnim,"play");
		dojo.connect(dojo.byId('easeInOut'),"onclick",easeInOutAnim,"play");
		dojo.connect(dojo.byId('linearEase'),"onclick",linearEaseAnim,"play");
		dojo.connect(window,"onclick",function(e){
			dojo.fx.slideTo({
				node:"bounce",
				top:e.pageY, left:e.pageX,
				easing: dojox.fx.easing.easeOutBack
			}).play();
		});

		// argh! FIXME: combine and chain are destructive to the animations. :(
		// allAnim = dojo.fx.combine([easeInAnim,easeOutAnim,easeInOutAnim]);
		allAnim = { play: function(){ 
			console.log("can't do this via fx.combine - destructive"); 
			easeInAnim.play();
			easeOutAnim.play();
			easeInOutAnim.play(); 
			linearEaseAnim.play();
			} 
		}; 

		}); // dojo.addOnLoad
	</script>
</head>
<body class="tundra">

	<h1 class="testTitle">dojox.fx.easing function tests:</h1>

	(click block to play animation, or <a href="#" onclick="allAnim.play()">here to do all three</a>)

	<div id="easeIn" class="block">dojox.fx.easing.easeIn</div>
	<br><br>
	<div id="easeOut" class="block">dojox.fx.easing.easeOut</div>
	<br><br>
	<div id="linearEase" class="block">dojox.fx.easing.linear</div>
	<br><br>
	<div id="easeInOut" class="block">dojo default easing</div>
	
	<p>
	dojox.fx.easing is stand-alone, and does not require the dojox.fx base files. to see a chart
	of these functions see <a href="example_easingChart2D.html">example_easingChart2D.html</a> 
	</p>	

	<div id="bounce" class="bounce">bounce</div>

</body>
</html>