2 * Copyright (c) 2012, Intel Corporation.
4 * This program is licensed under the terms and conditions of the
5 * Apache License, version 2.0. The full text of the Apache License is at
6 * http://www.apache.org/licenses/LICENSE-2.0
10 function Animation(id, startclass, ontime, property) {
13 self.elem = document.getElementById(id);
14 self.offclass = self.elem.className;
15 self.onclass = self.offclass+" "+startclass;
18 if(property != undefined)
21 self.elem.addEventListener('webkitTransitionEnd', function(e) {
22 if(e.propertyName === self.prop)
24 if(self.phase === "starting")
27 self.timer = setTimeout(function() {
28 self.phase = "ending";
29 self.elem.className = self.offclass;
32 else if(self.phase === "ending")
35 if(self.next&&self.next.begin)
43 Animation.prototype.begin = function() {
45 self.phase = "starting";
46 setTimeout(function(){self.elem.className = self.onclass;}, 0);
49 Animation.prototype.clear = function() {
52 clearTimeout(self.timer);
54 self.elem.className = self.offclass;
55 if(self.next&&self.next.clear)