atlasuiglitz.js
来自「《圣殿祭司的ASP.NET 2.0开发详解——使用C#》光盘内容.包含了书籍所含」· JavaScript 代码 · 共 617 行 · 第 1/2 页
JS
617 行
this.raisePropertyChanged('isPlaying');
if (!resume) {
this.raisePropertyChanged('isActive');
}
}
}
this.setOwner = function(owner) {
_parentAnimation = owner;
}
this.setValue = Function.abstractMethod;
this.stop = function() {
if (!_parentAnimation) {
if (_timer) {
_timer.dispose();
_timer = null;
this._updatePercentComplete(100);
this.onEnd();
this.raisePropertyChanged('isPlaying');
this.raisePropertyChanged('isActive');
}
}
}
this._onTimerTick = function() {
this._updatePercentComplete(_percentComplete + _percentDelta, true);
}
this._updatePercentComplete = function(percentComplete, animate) {
if (percentComplete > 100) {
percentComplete = 100;
}
_percentComplete = percentComplete;
this.raisePropertyChanged('percentComplete');
if (animate) {
this.onStep(percentComplete);
}
if (percentComplete == 100) {
this.stop();
}
}
}
Type.registerAbstractClass('Web.UI.Animation', Web.Component);
Web.UI.PropertyAnimation = function() {
Web.UI.PropertyAnimation.initializeBase(this, [false]);
var _property;
var _propertyKey;
this.get_property = function() {
return _property;
}
this.set_property = function(value) {
_property = value;
}
this.get_propertyKey = function() {
return _propertyKey;
}
this.set_propertyKey = function(value) {
_propertyKey = value;
}
this.ended = this.createEvent();
this.started = this.createEvent();
this.getDescriptor = function() {
var td = Web.UI.PropertyAnimation.callBaseMethod(this, 'getDescriptor');
td.addProperty('property', String);
td.addProperty('propertyKey', String);
return td;
}
Web.UI.PropertyAnimation.registerBaseMethod(this, 'getDescriptor');
this.setValue = function(value) {
Web.TypeDescriptor.setProperty(this.get_target(), _property, value, _propertyKey);
}
}
Type.registerAbstractClass('Web.UI.PropertyAnimation', Web.UI.Animation);
Web.UI.InterpolatedAnimation = function() {
Web.UI.InterpolatedAnimation.initializeBase(this);
var _startValue;
var _endValue;
this.get_endValue = function() {
return _endValue;
}
this.set_endValue = function(value) {
_endValue = value;
}
this.get_startValue = function() {
return _startValue;
}
this.set_startValue = function(value) {
_startValue = value;
}
}
Type.registerAbstractClass('Web.UI.InterpolatedAnimation', Web.UI.PropertyAnimation);
Web.UI.DiscreteAnimation = function() {
Web.UI.DiscreteAnimation.initializeBase(this);
var _values;
this.get_values = function() {
return _values;
}
this.set_values = function(value) {
_values = value;
}
this.getAnimatedValue = function(percentage) {
var index = Math.round((percentage / 100) * (_values.length - 1));
return _values[index];
}
this.getDescriptor = function() {
var td = Web.UI.DiscreteAnimation.callBaseMethod(this, 'getDescriptor');
td.addProperty('values', Array);
return td;
}
}
Type.registerSealedClass('Web.UI.DiscreteAnimation', Web.UI.PropertyAnimation);
Web.TypeDescriptor.addType('script', 'discreteAnimation', Web.UI.DiscreteAnimation);
Web.UI.NumberAnimation = function() {
Web.UI.NumberAnimation.initializeBase(this);
var _integralValues;
this.get_integralValues = function() {
return _integralValues;
}
this.set_integralValues = function(value) {
_integralValues = value;
}
this.getAnimatedValue = function(percentage) {
var value = Web.UI.Glitz.interpolate(this.get_startValue(),
this.get_endValue(),
percentage);
if (_integralValues) {
value = Math.round(value);
}
return value;
}
this.getDescriptor = function() {
var td = Web.UI.NumberAnimation.callBaseMethod(this, 'getDescriptor');
td.addProperty('startValue', Number);
td.addProperty('endValue', Number);
td.addProperty('integralValues', Boolean);
return td;
}
}
Type.registerSealedClass('Web.UI.NumberAnimation', Web.UI.InterpolatedAnimation);
Web.TypeDescriptor.addType('script', 'numberAnimation', Web.UI.NumberAnimation);
Web.UI.LengthAnimation = function() {
Web.UI.LengthAnimation.initializeBase(this);
var _unit = 'px';
this.get_unit = function() {
return _unit;
}
this.set_unit = function(value) {
_unit = value;
}
this.getAnimatedValue = function(percentage) {
var value = Web.UI.Glitz.interpolate(this.get_startValue(),
this.get_endValue(),
percentage);
return Math.round(value) + _unit;
}
this.getDescriptor = function() {
var td = Web.UI.LengthAnimation.callBaseMethod(this, 'getDescriptor');
td.addProperty('startValue', Number);
td.addProperty('endValue', Number);
td.addProperty('unit', String);
return td;
}
}
Type.registerSealedClass('Web.UI.LengthAnimation', Web.UI.InterpolatedAnimation);
Web.TypeDescriptor.addType('script', 'lengthAnimation', Web.UI.LengthAnimation);
Web.UI.CompositeAnimation = function() {
Web.UI.DiscreteAnimation.initializeBase(this);
var _animations = Web.Component.createCollection(this);
this.get_animations = function() {
return _animations;
}
this.getAnimatedValue = function(percentage) {
}
this.dispose = function() {
_animations.dispose();
_animations = null;
Web.UI.CompositeAnimation.callBaseMethod(this, 'dispose');
}
this.getDescriptor = function() {
var td = Web.UI.CompositeAnimation.callBaseMethod(this, 'getDescriptor');
td.addProperty('animations', Array, true);
return td;
}
this.onEnd = function() {
for (var i = 0; i < _animations.length; i++) {
_animations[i].onEnd();
}
}
this.onStart = function() {
for (var i = 0; i < _animations.length; i++) {
_animations[i].onStart();
}
}
this.onStep = function(percentage) {
for (var i = 0; i < _animations.length; i++) {
_animations[i].onStep(percentage);
}
}
}
Type.registerSealedClass('Web.UI.CompositeAnimation', Web.UI.Animation);
Web.TypeDescriptor.addType('script', 'compositeAnimation', Web.UI.CompositeAnimation);
Web.UI.FadeEffect = Web.Enum.create('FadeIn', 'FadeOut');
Web.UI.FadeAnimation = function() {
Web.UI.FadeAnimation.initializeBase(this);
var _effect = Web.UI.FadeEffect.FadeIn;
this.get_effect = function() {
return _effect;
}
this.set_effect = function(value) {
_effect = value;
}
this.getAnimatedValue = function(percentage) {
var startValue = 0;
var endValue = 1;
if (_effect == Web.UI.FadeEffect.FadeOut) {
startValue = 1;
endValue = 0;
}
return Web.UI.Glitz.interpolate(startValue, endValue, percentage);
}
this.getDescriptor = function() {
var td = Web.UI.FadeAnimation.callBaseMethod(this, 'getDescriptor');
td.addProperty('effect', Web.UI.FadeEffect);
return td;
}
this.onStart = function() {
var opacity = 0;
if (_effect == Web.UI.FadeEffect.FadeOut) {
opacity = 1;
}
this.setValue(opacity);
}
this.onEnd = function() {
var opacity = 1;
if (_effect == Web.UI.FadeEffect.FadeOut) {
opacity = 0;
}
this.setValue(opacity);
}
this.setValue = function(value) {
Web.UI.Glitz.setElementOpacity(this.get_target().element, value);
}
}
Type.registerSealedClass('Web.UI.FadeAnimation', Web.UI.Animation);
Web.TypeDescriptor.addType('script', 'fadeAnimation', Web.UI.FadeAnimation);
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?