mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
New build scripts
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5282 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
245
source/web/scripts/ajax/dojo/src/animation/Animation.js
Normal file
245
source/web/scripts/ajax/dojo/src/animation/Animation.js
Normal file
@@ -0,0 +1,245 @@
|
||||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.animation.Animation");
|
||||
dojo.require("dojo.animation.AnimationEvent");
|
||||
|
||||
dojo.require("dojo.lang.func");
|
||||
dojo.require("dojo.math");
|
||||
dojo.require("dojo.math.curves");
|
||||
|
||||
dojo.deprecated("dojo.animation.Animation is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5");
|
||||
|
||||
/*
|
||||
Animation package based off of Dan Pupius' work on Animations:
|
||||
http://pupius.co.uk/js/Toolkit.Drawing.js
|
||||
*/
|
||||
|
||||
dojo.animation.Animation = function(/*dojo.math.curves.* */ curve, /*int*/ duration, /*Decimal?*/ accel, /*int?*/ repeatCount, /*int?*/ rate) {
|
||||
// summary: Animation object iterates a set of numbers over a curve for a given amount of time, calling 'onAnimate' at each step.
|
||||
// curve: Curve to animate over.
|
||||
// duration: Duration of the animation, in milliseconds.
|
||||
// accel: Either an integer or curve representing amount of acceleration. (?) Default is linear acceleration.
|
||||
// repeatCount: Number of times to repeat the animation. Default is 0.
|
||||
// rate: Time between animation steps, in milliseconds. Default is 25.
|
||||
// description: Calls the following events: "onBegin", "onAnimate", "onEnd", "onPlay", "onPause", "onStop"
|
||||
// If the animation implements a "handler" function, that will be called before each event is called.
|
||||
|
||||
if(dojo.lang.isArray(curve)) {
|
||||
// curve: Array
|
||||
// id: i
|
||||
curve = new dojo.math.curves.Line(curve[0], curve[1]);
|
||||
}
|
||||
this.curve = curve;
|
||||
this.duration = duration;
|
||||
this.repeatCount = repeatCount || 0;
|
||||
this.rate = rate || 25;
|
||||
if(accel) {
|
||||
// accel: Decimal
|
||||
// id: j
|
||||
if(dojo.lang.isFunction(accel.getValue)) {
|
||||
// accel: dojo.math.curves.CatmullRom
|
||||
// id: k
|
||||
this.accel = accel;
|
||||
} else {
|
||||
var i = 0.35*accel+0.5; // 0.15 <= i <= 0.85
|
||||
this.accel = new dojo.math.curves.CatmullRom([[0], [i], [1]], 0.45);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dojo.lang.extend(dojo.animation.Animation, {
|
||||
// public properties
|
||||
curve: null,
|
||||
duration: 0,
|
||||
repeatCount: 0,
|
||||
accel: null,
|
||||
|
||||
// events
|
||||
onBegin: null,
|
||||
onAnimate: null,
|
||||
onEnd: null,
|
||||
onPlay: null,
|
||||
onPause: null,
|
||||
onStop: null,
|
||||
handler: null,
|
||||
|
||||
// "private" properties
|
||||
_animSequence: null,
|
||||
_startTime: null,
|
||||
_endTime: null,
|
||||
_lastFrame: null,
|
||||
_timer: null,
|
||||
_percent: 0,
|
||||
_active: false,
|
||||
_paused: false,
|
||||
_startRepeatCount: 0,
|
||||
|
||||
// public methods
|
||||
play: function(/*Boolean?*/ gotoStart) {
|
||||
// summary: Play the animation.
|
||||
// goToStart: If true, will restart the animation from the beginning.
|
||||
// Otherwise, starts from current play counter.
|
||||
// description: Sends an "onPlay" event to any observers.
|
||||
// Also sends an "onBegin" event if starting from the beginning.
|
||||
if( gotoStart ) {
|
||||
clearTimeout(this._timer);
|
||||
this._active = false;
|
||||
this._paused = false;
|
||||
this._percent = 0;
|
||||
} else if( this._active && !this._paused ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._startTime = new Date().valueOf();
|
||||
if( this._paused ) {
|
||||
this._startTime -= (this.duration * this._percent / 100);
|
||||
}
|
||||
this._endTime = this._startTime + this.duration;
|
||||
this._lastFrame = this._startTime;
|
||||
|
||||
var e = new dojo.animation.AnimationEvent(this, null, this.curve.getValue(this._percent),
|
||||
this._startTime, this._startTime, this._endTime, this.duration, this._percent, 0);
|
||||
|
||||
this._active = true;
|
||||
this._paused = false;
|
||||
|
||||
if( this._percent == 0 ) {
|
||||
if(!this._startRepeatCount) {
|
||||
this._startRepeatCount = this.repeatCount;
|
||||
}
|
||||
e.type = "begin";
|
||||
if(typeof this.handler == "function") { this.handler(e); }
|
||||
if(typeof this.onBegin == "function") { this.onBegin(e); }
|
||||
}
|
||||
|
||||
e.type = "play";
|
||||
if(typeof this.handler == "function") { this.handler(e); }
|
||||
if(typeof this.onPlay == "function") { this.onPlay(e); }
|
||||
|
||||
if(this._animSequence) { this._animSequence._setCurrent(this); }
|
||||
|
||||
this._cycle();
|
||||
},
|
||||
|
||||
pause: function() {
|
||||
// summary: Temporarily stop the animation, leaving the play counter at the current location.
|
||||
// Resume later with sequence.play()
|
||||
// description: Sends an "onPause" AnimationEvent to any observers.
|
||||
clearTimeout(this._timer);
|
||||
if( !this._active ) { return; }
|
||||
this._paused = true;
|
||||
var e = new dojo.animation.AnimationEvent(this, "pause", this.curve.getValue(this._percent),
|
||||
this._startTime, new Date().valueOf(), this._endTime, this.duration, this._percent, 0);
|
||||
if(typeof this.handler == "function") { this.handler(e); }
|
||||
if(typeof this.onPause == "function") { this.onPause(e); }
|
||||
},
|
||||
|
||||
playPause: function() {
|
||||
// summary: Toggle between play and paused states.
|
||||
if( !this._active || this._paused ) {
|
||||
this.play();
|
||||
} else {
|
||||
this.pause();
|
||||
}
|
||||
},
|
||||
|
||||
gotoPercent: function(/*int*/ pct, /*Boolean*/ andPlay) {
|
||||
// summary: Set the play counter at a certain point in the animation.
|
||||
// pct: Point to set the play counter to, expressed as a percentage (0 to 100).
|
||||
// andPlay: If true, will start the animation at the counter automatically.
|
||||
clearTimeout(this._timer);
|
||||
this._active = true;
|
||||
this._paused = true;
|
||||
this._percent = pct;
|
||||
if( andPlay ) { this.play(); }
|
||||
},
|
||||
|
||||
stop: function(/*Boolean?*/ gotoEnd) {
|
||||
// summary: Stop the animation.
|
||||
// gotoEnd: If true, will advance play counter to the end before sending the event.
|
||||
// description: Sends an "onStop" AnimationEvent to any observers.
|
||||
clearTimeout(this._timer);
|
||||
var step = this._percent / 100;
|
||||
if( gotoEnd ) {
|
||||
step = 1;
|
||||
}
|
||||
var e = new dojo.animation.AnimationEvent(this, "stop", this.curve.getValue(step),
|
||||
this._startTime, new Date().valueOf(), this._endTime, this.duration, this._percent);
|
||||
if(typeof this.handler == "function") { this.handler(e); }
|
||||
if(typeof this.onStop == "function") { this.onStop(e); }
|
||||
this._active = false;
|
||||
this._paused = false;
|
||||
},
|
||||
|
||||
status: function() {
|
||||
// summary: Return the status of the animation.
|
||||
// description: Returns one of "playing", "paused" or "stopped".
|
||||
if( this._active ) {
|
||||
return this._paused ? "paused" : "playing"; /* String */
|
||||
} else {
|
||||
return "stopped"; /* String */
|
||||
}
|
||||
},
|
||||
|
||||
// "private" methods
|
||||
_cycle: function() {
|
||||
// summary: Perform once 'cycle' or step of the animation.
|
||||
clearTimeout(this._timer);
|
||||
if( this._active ) {
|
||||
var curr = new Date().valueOf();
|
||||
var step = (curr - this._startTime) / (this._endTime - this._startTime);
|
||||
var fps = 1000 / (curr - this._lastFrame);
|
||||
this._lastFrame = curr;
|
||||
|
||||
if( step >= 1 ) {
|
||||
step = 1;
|
||||
this._percent = 100;
|
||||
} else {
|
||||
this._percent = step * 100;
|
||||
}
|
||||
|
||||
// Perform accelleration
|
||||
if(this.accel && this.accel.getValue) {
|
||||
step = this.accel.getValue(step);
|
||||
}
|
||||
|
||||
var e = new dojo.animation.AnimationEvent(this, "animate", this.curve.getValue(step),
|
||||
this._startTime, curr, this._endTime, this.duration, this._percent, Math.round(fps));
|
||||
|
||||
if(typeof this.handler == "function") { this.handler(e); }
|
||||
if(typeof this.onAnimate == "function") { this.onAnimate(e); }
|
||||
|
||||
if( step < 1 ) {
|
||||
this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate);
|
||||
} else {
|
||||
e.type = "end";
|
||||
this._active = false;
|
||||
if(typeof this.handler == "function") { this.handler(e); }
|
||||
if(typeof this.onEnd == "function") { this.onEnd(e); }
|
||||
|
||||
if( this.repeatCount > 0 ) {
|
||||
this.repeatCount--;
|
||||
this.play(true);
|
||||
} else if( this.repeatCount == -1 ) {
|
||||
this.play(true);
|
||||
} else {
|
||||
if(this._startRepeatCount) {
|
||||
this.repeatCount = this._startRepeatCount;
|
||||
this._startRepeatCount = 0;
|
||||
}
|
||||
if( this._animSequence ) {
|
||||
this._animSequence._playNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
64
source/web/scripts/ajax/dojo/src/animation/AnimationEvent.js
Normal file
64
source/web/scripts/ajax/dojo/src/animation/AnimationEvent.js
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.animation.AnimationEvent");
|
||||
dojo.require("dojo.lang.common");
|
||||
|
||||
dojo.deprecated("dojo.animation.AnimationEvent is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5");
|
||||
|
||||
dojo.animation.AnimationEvent = function(
|
||||
/*dojo.animation.Animation*/ animation,
|
||||
/*String*/type,
|
||||
/*int[] */ coords,
|
||||
/*int*/ startTime,
|
||||
/*int*/ currentTime,
|
||||
/*int*/ endTime,
|
||||
/*int*/ duration,
|
||||
/*int*/ percent,
|
||||
/*int?*/ fps) {
|
||||
// summary: Event sent at various points during an Animation.
|
||||
// animation: Animation throwing the event.
|
||||
// type: One of: "animate", "begin", "end", "play", "pause" or "stop".
|
||||
// coords: Current coordinates of the animation.
|
||||
// startTime: Time the animation was started, as milliseconds.
|
||||
// currentTime: Time the event was thrown, as milliseconds.
|
||||
// endTime: Time the animation is expected to complete, as milliseconds.
|
||||
// duration: Duration of the animation, in milliseconds.
|
||||
// percent: Percent of the animation that has completed, between 0 and 100.
|
||||
// fps: Frames currently shown per second. (Only sent for "animate" event).
|
||||
// description: The AnimationEvent has public properties of the same name as
|
||||
// all constructor arguments, plus "x", "y" and "z".
|
||||
|
||||
this.type = type; // "animate", "begin", "end", "play", "pause", "stop"
|
||||
this.animation = animation;
|
||||
|
||||
this.coords = coords;
|
||||
this.x = coords[0];
|
||||
this.y = coords[1];
|
||||
this.z = coords[2];
|
||||
|
||||
this.startTime = startTime;
|
||||
this.currentTime = currentTime;
|
||||
this.endTime = endTime;
|
||||
|
||||
this.duration = duration;
|
||||
this.percent = percent;
|
||||
this.fps = fps;
|
||||
};
|
||||
dojo.extend(dojo.animation.AnimationEvent, {
|
||||
coordsAsInts: function() {
|
||||
// summary: Coerce the coordinates into integers.
|
||||
var cints = new Array(this.coords.length);
|
||||
for(var i = 0; i < this.coords.length; i++) {
|
||||
cints[i] = Math.round(this.coords[i]);
|
||||
}
|
||||
return cints;
|
||||
}
|
||||
});
|
162
source/web/scripts/ajax/dojo/src/animation/AnimationSequence.js
Normal file
162
source/web/scripts/ajax/dojo/src/animation/AnimationSequence.js
Normal file
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.animation.AnimationSequence");
|
||||
dojo.require("dojo.animation.AnimationEvent");
|
||||
dojo.require("dojo.animation.Animation");
|
||||
|
||||
dojo.deprecated("dojo.animation.AnimationSequence is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5");
|
||||
|
||||
dojo.animation.AnimationSequence = function(/*int?*/ repeatCount){
|
||||
// summary: Sequence of Animations, played one after the other.
|
||||
// repeatCount: Number of times to repeat the entire sequence. Default is 0 (play once only).
|
||||
// description: Calls the following events: "onBegin", "onEnd", "onNext"
|
||||
// If the animation implements a "handler" function, that will be called before each event is called.
|
||||
this._anims = [];
|
||||
this.repeatCount = repeatCount || 0;
|
||||
}
|
||||
|
||||
dojo.lang.extend(dojo.animation.AnimationSequence, {
|
||||
repeatCount: 0,
|
||||
|
||||
_anims: [],
|
||||
_currAnim: -1,
|
||||
|
||||
onBegin: null,
|
||||
onEnd: null,
|
||||
onNext: null,
|
||||
handler: null,
|
||||
|
||||
add: function() {
|
||||
// summary: Add one or more Animations to the sequence.
|
||||
// description: args: Animations (dojo.animation.Animation) to add to the sequence.
|
||||
for(var i = 0; i < arguments.length; i++) {
|
||||
this._anims.push(arguments[i]);
|
||||
arguments[i]._animSequence = this;
|
||||
}
|
||||
},
|
||||
|
||||
remove: function(/*dojo.animation.Animation*/ anim) {
|
||||
// summary: Remove one particular animation from the sequence.
|
||||
// amim: Animation to remove.
|
||||
for(var i = 0; i < this._anims.length; i++) {
|
||||
if( this._anims[i] == anim ) {
|
||||
this._anims[i]._animSequence = null;
|
||||
this._anims.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
removeAll: function() {
|
||||
// summary: Remove all animations from the sequence.
|
||||
for(var i = 0; i < this._anims.length; i++) {
|
||||
this._anims[i]._animSequence = null;
|
||||
}
|
||||
this._anims = [];
|
||||
this._currAnim = -1;
|
||||
},
|
||||
|
||||
clear: function() {
|
||||
// summary: Remove all animations from the sequence.
|
||||
this.removeAll();
|
||||
},
|
||||
|
||||
play: function(/*Boolean?*/ gotoStart) {
|
||||
// summary: Play the animation sequence.
|
||||
// gotoStart: If true, will start at the beginning of the first sequence.
|
||||
// Otherwise, starts at the current play counter of the current animation.
|
||||
// description: Sends an "onBegin" event to any observers.
|
||||
if( this._anims.length == 0 ) { return; }
|
||||
if( gotoStart || !this._anims[this._currAnim] ) {
|
||||
this._currAnim = 0;
|
||||
}
|
||||
if( this._anims[this._currAnim] ) {
|
||||
if( this._currAnim == 0 ) {
|
||||
var e = {type: "begin", animation: this._anims[this._currAnim]};
|
||||
if(typeof this.handler == "function") { this.handler(e); }
|
||||
if(typeof this.onBegin == "function") { this.onBegin(e); }
|
||||
}
|
||||
this._anims[this._currAnim].play(gotoStart);
|
||||
}
|
||||
},
|
||||
|
||||
pause: function() {
|
||||
// summary: temporarily stop the current animation. Resume later with sequence.play()
|
||||
if( this._anims[this._currAnim] ) {
|
||||
this._anims[this._currAnim].pause();
|
||||
}
|
||||
},
|
||||
|
||||
playPause: function() {
|
||||
// summary: Toggle between play and paused states.
|
||||
if( this._anims.length == 0 ) { return; }
|
||||
if( this._currAnim == -1 ) { this._currAnim = 0; }
|
||||
if( this._anims[this._currAnim] ) {
|
||||
this._anims[this._currAnim].playPause();
|
||||
}
|
||||
},
|
||||
|
||||
stop: function() {
|
||||
// summary: Stop the current animation.
|
||||
if( this._anims[this._currAnim] ) {
|
||||
this._anims[this._currAnim].stop();
|
||||
}
|
||||
},
|
||||
|
||||
status: function() {
|
||||
// summary: Return the status of the current animation.
|
||||
// description: Returns one of "playing", "paused" or "stopped".
|
||||
if( this._anims[this._currAnim] ) {
|
||||
return this._anims[this._currAnim].status();
|
||||
} else {
|
||||
return "stopped";
|
||||
}
|
||||
},
|
||||
|
||||
_setCurrent: function(/*dojo.animation.Animation*/ anim) {
|
||||
// summary: Set the current animation.
|
||||
// anim: Animation to make current, must have already been added to the sequence.
|
||||
for(var i = 0; i < this._anims.length; i++) {
|
||||
if( this._anims[i] == anim ) {
|
||||
this._currAnim = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_playNext: function() {
|
||||
// summary: Play the next animation in the sequence.
|
||||
// description: Sends an "onNext" event to any observers.
|
||||
// Also sends "onEnd" if the last animation is finished.
|
||||
if( this._currAnim == -1 || this._anims.length == 0 ) { return; }
|
||||
this._currAnim++;
|
||||
if( this._anims[this._currAnim] ) {
|
||||
var e = {type: "next", animation: this._anims[this._currAnim]};
|
||||
if(typeof this.handler == "function") { this.handler(e); }
|
||||
if(typeof this.onNext == "function") { this.onNext(e); }
|
||||
this._anims[this._currAnim].play(true);
|
||||
} else {
|
||||
var e = {type: "end", animation: this._anims[this._anims.length-1]};
|
||||
if(typeof this.handler == "function") { this.handler(e); }
|
||||
if(typeof this.onEnd == "function") { this.onEnd(e); }
|
||||
if(this.repeatCount > 0) {
|
||||
this._currAnim = 0;
|
||||
this.repeatCount--;
|
||||
this._anims[this._currAnim].play(true);
|
||||
} else if(this.repeatCount == -1) {
|
||||
this._currAnim = 0;
|
||||
this._anims[this._currAnim].play(true);
|
||||
} else {
|
||||
this._currAnim = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
16
source/web/scripts/ajax/dojo/src/animation/Timer.js
Normal file
16
source/web/scripts/ajax/dojo/src/animation/Timer.js
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.provide("dojo.animation.Timer");
|
||||
dojo.require("dojo.lang.timing.Timer");
|
||||
|
||||
dojo.deprecated("dojo.animation.Timer is now dojo.lang.timing.Timer", "0.5");
|
||||
|
||||
dojo.animation.Timer = dojo.lang.timing.Timer;
|
20
source/web/scripts/ajax/dojo/src/animation/__package__.js
Normal file
20
source/web/scripts/ajax/dojo/src/animation/__package__.js
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright (c) 2004-2006, The Dojo Foundation
|
||||
All Rights Reserved.
|
||||
|
||||
Licensed under the Academic Free License version 2.1 or above OR the
|
||||
modified BSD license. For more information on Dojo licensing, see:
|
||||
|
||||
http://dojotoolkit.org/community/licensing.shtml
|
||||
*/
|
||||
|
||||
dojo.kwCompoundRequire({
|
||||
common: [
|
||||
"dojo.animation.AnimationEvent",
|
||||
"dojo.animation.Animation",
|
||||
"dojo.animation.AnimationSequence"
|
||||
]
|
||||
});
|
||||
dojo.provide("dojo.animation.*");
|
||||
|
||||
dojo.deprecated("dojo.Animation.* is slated for removal in 0.5; use dojo.lfx.* instead.", "0.5");
|
Reference in New Issue
Block a user