1// Name: AnimationScripts.debug.js 2// Assembly: AjaxControlToolkit 3// Version: 17.1.1.0 4// FileVersion: 17.1.1.0 5Type.registerNamespace('Sys.Extended.UI.Animation'); 6 7// Create an alias for the namespace to save 25 chars each time it's used since 8// this is a very long script and will take awhile to download 9$AA = Sys.Extended.UI.Animation; 10 11$AA.registerAnimation = function(name, type) { 12 // Register an animation with the AJAX Control Toolkit animation framework. This serves a dual purpose: 13 // 1) to add standard utility methods to the animation type (such as a play method that creates 14 // an animation, plays it, and disposes it when the animation is over), and 2) to associate a name with the 15 // type that will be used when creating animations from a JSON description. This method can also be called 16 // by other animation libraries to seamlessly interoperate with the AJAX Control Toolkit's animation 17 // framework. 18 // 19 // "name" - name of the animation that will be used as the XML tag name in the XML animation description. It 20 // should be a valid XML tag (i.e. an alpha-numeric sequence with no spaces, special characters, etc.). 21 // Make sure the type inherits from Sys.Extended.UI.Animation.Animation 22 if(type && ((type === $AA.Animation) || (type.inheritsFrom && type.inheritsFrom($AA.Animation)))) { 23 // We'll store the animation name/type mapping in a "static" object off of 24 // Sys.Extended.UI.Animation. If this __animations object hasn't been 25 // created yet, demand create it on the first registration. 26 if(!$AA.__animations) { 27 $AA.__animations = {}; 28 } 29 30 // Add the current type to the collection of animations 31 $AA.__animations[name.toLowerCase()] = type; 32 33 // Add a play function that will make it very easy to create, play, and 34 // dispose of an animation. This is effectively a "static" function on 35 // each animation and will take the same parameters as that animation's 36 // constructor. 37 type.play = function() { 38 // Create an animation, play it immediately, and dispose it when finished. 39 // The play function takes the same parameters as the type's constructor 40 41 // Create and initialize a new animation of the right type and pass in 42 // any arguments given to the play function 43 var animation = new type(); 44 type.apply(animation, arguments); 45 animation.initialize(); 46 47 // Add an event handler to dispose the animation when it's finished 48 var handler = Function.createDelegate(animation, 49 function() { 50 // Dispose the animation after playing 51 animation.remove_ended(handler); 52 handler = null; 53 animation.dispose(); 54 }); 55 animation.add_ended(handler); 56 57 // Once the animation has been created and initialized, play it and 58 // dispose it as soon as it's finished 59 animation.play(); 60 } 61 } else { 62 // Raise an error if someone registers an animation that doesn't inherit 63 // from our base Animation class 64 throw Error.argumentType('type', type, $AA.Animation, Sys.Extended.UI.Resources.Animation_InvalidBaseType); 65 } 66} 67 68$AA.buildAnimation = function(json, defaultTarget) { 69 // The buildAnimation function is used to turn a JSON animation description 70 // into an actual animation object that can be played. 71 // 72 // "json" - JSON description of the animation in the format expected by createAnimation 73 // "defaultTarget" - target of the animation if none is specified in the JSON description. The semantics of 74 // target assignment are provided in more detail in createAnimation. 75 76 // Ensure we have a description to create an animation with 77 if(!json || json === '') { 78 return null; 79 } 80 81 // "Parse" the JSON so we can easily manipulate it 82 // (we don't wrap it in a try/catch when debugging to raise any errors) 83 var obj; 84 json = '(' + json + ')'; 85 if(!Sys.Debug.isDebug) { 86 try { obj = Sys.Serialization.JavaScriptSerializer.deserialize(json); } catch(ex) { } 87 } else { 88 obj = Sys.Serialization.JavaScriptSerializer.deserialize(json); 89 } 90 91 // Create a new instance of the animation 92 return $AA.createAnimation(obj, defaultTarget); 93} 94 95$AA.createAnimation = function(obj, defaultTarget) { 96 // The createAnimation function builds a new Sys.Extended.UI.Animation.Animation instance from an object 97 // that describes it. 98 // Exceptions are thrown when the AnimationName cannot be found. Also, 99 // any exceptions raised by setting properties or providing properties with invali
99d 100 // names will only be raised when debugging. 101 // 102 // "obj" - the object provides a description of the animation to be be generated in 103 // a very specific format. It has two special properties: AnimationName 104 // and AnimationChildren. The AnimationName is required 105 // and used to find the type of animation to create (this name should map to 106 // one of the animation names supplied to registerAnimation). The 107 // AnimationChildren property supplies an optional array for 108 // animations that use child animations (such as 109 // Sys.Extended.UI.Animation.ParallelAnimation and 110 // Sys.Extended.UI.Animation.SequenceAnimation). The elements of 111 // the AnimationChildren array are valid 112 // Sys.Extended.UI.Animation.Animation objects that meet these same 113 // requirements. In order for an animation to support child animations, it must 114 // derive from the Sys.Extended.UI.Animation.ParentAnimation class 115 // which provides common methods like add, clear, etc. The 116 // remaining properties of the object are used to set parameters specific to the type 117 // of animation being created (e.g. duration, minimumOpacity, 118 // startValue, etc.) and should have a corresponding property on the 119 // animation. You can also assign an arbitrary JavaScript expression to any property 120 // by adding 'Script' to the end of its name (i.e., Height="70" can be replaced by 121 // HeightScript="$get('myElement').offsetHeight") and have the property set to the 122 // result of evaluating the expression before the animation is played each time. 123 // "defaultTarget" - the function also takes a defaultTarget parameter that is used as the 124 // target of the animation if the object does not specify one. This parameter should be 125 // an instance of Sys.UI.DomElement and not just the name of an element. 126 127 // Create a default instance of the animation by looking up the AnimationName 128 // in the global __animations object. 129 if(!obj || !obj.AnimationName) { 130 throw Error.argument('obj', Sys.Extended.UI.Resources.Animation_MissingAnimationName); 131 } 132 var type = $AA.__animations[obj.AnimationName.toLowerCase()]; 133 if(!type) { 134 throw Error.argument('type', String.format(Sys.Extended.UI.Resources.Animation_UknownAnimationName, obj.AnimationName)); 135 } 136 var animation = new type(); 137 138 // Set the animation's target if provided via defaultTarget (note that setting 139 // it via AnimationTarget will happen during the regular property setting phase) 140 if(defaultTarget) { 141 animation.set_target(defaultTarget); 142 } 143 144 // If there is an AnimationChildren array and the animation inherits from 145 // ParentAnimation, then we will recusively build the child animations. It is 146 // important that we create the child animations before setting the animation's 147 // properties or initializing (because some properties and initialization may be 148 // propogated down from parent to child). 149 if(obj.AnimationChildren && obj.AnimationChildren.length) { 150 if($AA.ParentAnimation.isInstanceOfType(animation)) { 151 for(var i = 0; i < obj.AnimationChildren.length; i++) { 152 var child = $AA.createAnimation(obj.AnimationChildren[i]); 153 if(child) { 154 animation.add(child); 155 } 156 } 157 } else { 158 throw Error.argument('obj', String.format(Sys.Extended.UI.Resources.Animation_ChildrenNotAllowed, type.getName())); 159 } 160 } 161 162 // Get the list of all properties available to set on the current animation's 163 // type. We create a mapping from the property's lowercase friendly name 164 // (i.e., "duration") to the name of its setter (i.e., "set_duration"). This is 165 // essentialy in setting properties so we only copy over valid values. 166 var properties = type.__animationProperties; 167 if(!properties) { 168 // Get the properties for this type by walking its prototype - by doing 169 // this we'll effectively ignore anything not defined in the prototype 170 type.__animationProperties = {}; 171 type.resolveInheritance(); 172 for(var name in type.prototype) { 173 if(name.startsWith('set_')) { 174 type.__animationProperties[name.substr(4).toLowerCase()] = name; 175 } 176 } 177 178 // Remove the 'id' property as it shouldn't be set by the animation 179 // (NOTE: the 'target' proeprty shouldn't be set to a string value, but it 180 // isn't removed because it can be used as a valid dynamic property - i.e. 181 // Target="myElement" *DOES NOT WORK*, but it's OKAY to use 182 // TargetScript="$get('myElement')". Validation for this scenario will be 183 // handled automatically by _validateParams when debugging as Target is required 184 // to be a dom element.) 185 delete type.__animationProperties['id']; 186 properties = type.__animationProperties; 187 } 188 189 // Loop through each of the properties in the object and check if it's in the list 190 // of valid property names. We will check the type of the propertyName to make sure 191 // it's a String (as other types can be added by the ASP.NET AJAX compatability 192 // layers to all objects and cause errors if you don't exclude them). We will first
193 // try to set a property with the same name if it exists. If we can't find one but 194 // the name of the property ends in 'script', then we will try to set a corresponding 195 // dynamic property. If no matches can be found at all, we'll raise an error when 196 // debugging. 197 for(var property in obj) { 198 // Ignore the special properties in the object that don't correspond 199 // to any actual properties on the animation 200 var prop = property.toLowerCase(); 201 if(prop == 'animationname' || prop == 'animationchildren') { 202 continue; 203 } 204 205 var value = obj[property]; 206 207 // Try to directly set the value of this property 208 var setter = properties[prop]; 209 if(setter && String.isInstanceOfType(setter) && animation[setter]) { 210 // Ignore any exceptions raised by setting the property 211 // unless we're debugging 212 if(!Sys.Debug.isDebug) { 213 try { animation[setter](value); } catch(ex) { } 214 } else { 215 animation[setter](value); 216 } 217 } else { 218 // Try to set the value of a dynamic property 219 if(prop.endsWith('script')) { 220 setter = properties[prop.substr(0, property.length - 6)]; 221 if(setter && String.isInstanceOfType(setter) && animation[setter]) { 222 animation.DynamicProperties[setter] = value; 223 } else if(Sys.Debug.isDebug) { 224 // Raise an error when debugging if we could not find a matching property 225 throw Error.argument('obj', String.format(Sys.Extended.UI.Resources.Animation_NoDynamicPropertyFound, property, property.substr(0, property.length - 5))); 226 } 227 } else if(Sys.Debug.isDebug) { 228 // Raise an error when debugging if we could not find a matching property 229 throw Error.argument('obj', String.format(Sys.Extended.UI.Resources.Animation_NoPropertyFound, property)); 230 } 231 } 232 } 233 234 return animation; 235} 236 237// In the Xml comments for each of the animations below, there is a special <animation /> tag 238// that describes how the animation is referenced from a generic XML animation description 239 240///<summary> 241/// Animation is an abstract base class used as a starting point for all the other animations. 242/// It provides the basic mechanics for the animation (playing, pausing, stopping, timing, etc.) 243/// and leaves the actual animation to be done in the abstract methods getAnimatedValue 244/// and setValue. 245///</summary> 246///<member name="cT:AjaxControlToolkit.Animation" /> 247 248/// <summary /> 249/// <member name="cM:AjaxControlToolkit.Animation.ctor" /> 250/// <param name="target" type="Object">Target of the animation.</param> 251/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 252/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 253$AA.Animation = function(target, duration, fps) { 254 // Animations need to be as fast as possible - even in debug mode. Don't add validation code to 255 // methods involved in every step of the animation. 256 // 257 // The DynamicProperties collection is used to associate JavaScript expressions with 258 // properties. The expressions are evaluated just before the animation is played 259 // everytime (in the base onStart method). The object itself maps strings with the 260 // names of property setters (like "set_verticalOffset") to JavaScript expressions 261 // (like "$find('MyBehavior').get_element().offsetHeight"). Note specifically that 262 // the dynamic properties are JavaScript expressions and not abitrary statements (i.e. 263 // you can't include things like "return foo;"), although you can include anything 264 // inside an anonymous function definition that you immediately invoke (i.e., 265 // "(function() { return foo; })()"). A dynamic property can be set in the generic 266 // XML animation description by appending Script onto any legitimate property name 267 // (for example, instead of Height="70" we could use
268 // HeightScript="$find('MyBehavior').get_element().offsetHeight"). Any exceptions 269 // raised when setting dynamic properties (including both JavaScript evaluation errors 270 // and other exceptions raised by property setters) will only be propogated when 271 // debugging. 272 273 $AA.Animation.initializeBase(this); 274 275 ///<summary> 276 /// Length of the animation in seconds. The default is 1. 277 ///</summary> 278 ///<getter>get_duration</getter> 279 ///<setter>set_duration</setter> 280 ///<member name="cP:AjaxControlToolkit.Animation.duration" /> 281 this._duration = 1; 282 283 ///<summary> 284 /// Number of steps per second. The default is 25. 285 ///</summary> 286 ///<getter>get_fps</getter> 287 ///<setter>set_fps</setter> 288 ///<member name="cP:AjaxControlToolkit.Animation.fps" /> 289 this._fps = 25; 290 291 ///<summary> 292 /// Target Sys.UI.DomElement of the animation. If the target of this animation is null and 293 /// the animation has a parent, then it will recursively use the target of 294 /// the parent animation instead. 295 ///</summary> 296 /// <remarks> 297 /// Do not set this property in a generic Xml animation description. It should be set 298 /// using either the extender's TargetControlID or the AnimationTarget property (the latter 299 /// maps to Sys.Extended.UI.Animation.set_animationTarget). The only valid way to 300 /// set this property in the generic Xml animation description is to use the dynamic 301 /// property TargetScript="$get('myElement')". 302 /// </remarks> 303 ///<getter>get_target</getter> 304 ///<setter>set_target</setter> 305 ///<member name="cP:AjaxControlToolkit.Animation.target" /> 306 this._target = null; 307 308 // Tick event handler 309 this._tickHandler = null; 310 311 // Animation timer 312 this._timer = null; 313 314 ///<summary> 315 /// Percentage of the animation already played. 316 ///</summary> 317 ///<getter>get_percentComplete</getter> 318 ///<setter>set_percentComplete</setter> 319 ///<member name="cP:AjaxControlToolkit.Animation.percentComplete" /> 320 this._percentComplete = 0; 321 322 // Percentage of the animation to play on each step 323 this._percentDelta = null; 324 325 // Reference to the animation that owns this animation (currently only set in 326 // ParallelAnimation.add). This concept of ownership allows an entire animation 327 // subtree to be driven off a single timer so all the operations are properly 328 // synchronized. 329 this._owner = null; 330 331 // Reference to the animation that contains this as a child (this is set 332 // in ParentAnimation.add). The primary use of the parent animation is in 333 // resolving the animation target when one isn't specified. 334 this._parentAnimation = null; 335 336 // The DynamicProperties collection is used to associate JavaScript expressions with 337 // properties. The expressions are evaluated just before the animation is played 338 // everytime (in the base onStart method). See the additional information in the 339 // XML <field> comment above. 340 this.DynamicProperties = {}; 341 342 // Set the target, duration, and fps if they were provided in the constructor 343 if(target) { 344 this.set_target(target); 345 } 346 if(duration) { 347 this.set_duration(duration); 348 } 349 if(fps) { 350 this.set_fps(fps); 351 } 352} 353 354$AA.Animation.prototype = { 355 dispose: function() { 356 if(this._timer) { 357 this._timer.dispose(); 358 this._timer = null; 359 } 360 361 this._tickHandler = null; 362 this._target = null; 363 364 $AA.Animation.callBaseMethod(this, 'dispose'); 365 }, 366 367 /// <summary> 368 /// Play the animation from the beginning or where it was left off when paused. 369 /// </summary> 370 /// <remarks> 371 /// If this animation is the child of another, you must call play on its parent instead. 372 /// </remarks> 373 /// <member name="cM:AjaxControlToolkit.Animation.play" /> 374 play: function() { 375 // If ownership of this animation has been claimed, then we'll require the parent to 376 // handle playing the animation (this is very important because then the entire animation 377 // tree runs on the same timer and updates consistently) 378 if(!this._owner) { 379 var resume = true; 380 if(!this._timer) { 381 resume = false;
382 383 if(!this._tickHandler) { 384 this._tickHandler = Function.createDelegate(this, this._onTimerTick); 385 } 386 387 this._timer = new Sys.Timer(); 388 this._timer.add_tick(this._tickHandler); 389 390 this.onStart(); 391 392 this._timer.set_interval(1000 / this._fps); 393 this._percentDelta = 100 / (this._duration * this._fps); 394 this._updatePercentComplete(0, true); 395 } 396 397 this._timer.set_enabled(true); 398 399 this.raisePropertyChanged('isPlaying'); 400 if(!resume) { 401 this.raisePropertyChanged('isActive'); 402 } 403 } 404 }, 405 406 /// <summary> 407 /// Pause the animation if it is playing. Calling play will resume where 408 /// the animation left off. 409 /// </summary> 410 /// <remarks> 411 /// If this animation is the child of another, you must call pause on its parent instead. 412 /// </remarks> 413 /// <member name="cM:AjaxControlToolkit.Animation.pause" /> 414 pause: function() { 415 if(!this._owner) { 416 if(this._timer) { 417 this._timer.set_enabled(false); 418 419 this.raisePropertyChanged('isPlaying'); 420 } 421 } 422 }, 423 424 /// <summary> 425 /// Stop playing the animation. 426 /// </summary> 427 /// <remarks> 428 /// If this animation is the child of another, you must call stop on 429 /// its parent instead. 430 /// </remarks> 431 /// <member name="cM:AjaxControlToolkit.Animation.stop" /> 432 /// <param name="finish" type="Boolean">Whether or not stopping the animation should leave the target element in a state 433 /// consistent with the animation playing completely by performing the last step. 434 /// The default value is true.</param> 435 stop: function(finish) { 436 if(!this._owner) { 437 var t = this._timer; 438 this._timer = null; 439 if(t) { 440 t.dispose(); 441 442 if(this._percentComplete !== 100) { 443 this._percentComplete = 100; 444 this.raisePropertyChanged('percentComplete'); 445 if(finish || finish === undefined) { 446 this.onStep(100); 447 } 448 } 449 this.onEnd(); 450 451 this.raisePropertyChanged('isPlaying'); 452 this.raisePropertyChanged('isActive'); 453 } 454 } 455 }, 456 457 /// <summary> 458 /// The onStart method is called just before the animation is played each time. 459 /// </summary> 460 /// <member name="cM:AjaxControlToolkit.Animation.onStart" /> 461 onStart: function() { 462 this.raise_started(); 463 464 // Initialize any dynamic properties 465 for(var property in this.DynamicProperties) { 466 try { 467 // Invoke the property's setter on the evaluated expression 468 this[property](eval(this.DynamicProperties[property])); 469 } catch(ex) { 470 // Propogate any exceptions if we're debugging, otherwise eat them 471 if(Sys.Debug.isDebug) { 472 throw ex; 473 } 474 } 475 } 476 }, 477 478 /// <summary> 479 /// The onStep method is called repeatedly to progress the animation through each frame. 480 /// </summary> 481 /// <member name="cM:AjaxControlToolkit.Animation.onStep" /> 482 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 483 onStep: function(percentage) { 484 this.setValue(this.getAnimatedValue(percentage)); 485 this.raise_step(); 486 }, 487 488 /// <summary> 489 /// The onEnd method is called just after the animation is played each time. 490 /// </summary> 491 /// <member name="cM:AjaxControlToolkit.Animation.onEnd" /> 492 onEnd: function() { 493 this.raise_ended(); 494 }, 495 496 /// <summary> 497 /// Determine the state of the animation after the given percentage of its duration has elapsed. 498 /// </summary> 499 /// <member name="cM:AjaxControlToolkit.Animation.getAnimatedValue" /> 500 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 501 getAnimatedValue: function(percentage) { 502 // Returns state of the animation after the given percentage of its duration has elapsed that will 503 // be passed to setValue 504 throw Error.notImplemented(); 505 }, 506 507 /// <summary> 508 /// Set the current state of the animation. 509 /// </summary> 510 /// <member name="cM:AjaxControlToolkit.Animation.setValue" /> 511 /// <param name="value" type="Object">Animation state.</param> 512 setValue: function(value) { 513 // Returns current state of the animation (as retreived from getAnimatedValue) 514 throw Error.notImplemented(); 515 }, 516 517 /// <summary> 518 /// The interpolate function is used to find the appropriate value between starting and
519 /// ending values given the current percentage. 520 /// </summary> 521 /// <member name="cM:AjaxControlToolkit.Animation.interpolate" /> 522 /// <param name="start" type="Number">Start of the range to interpolate.</param> 523 /// <param name="end" type="Number">End of the range to interpolate.</param> 524 /// <param name="percentage" type="Number">Percentage completed in the range to interpolate.</param> 525 interpolate: function(start, end, percentage) { 526 // In the future, we hope to make several implementations of this available so we can dynamically 527 // change the apparent speed of the animations, although it may make more sense to modify the 528 // _updatePercentComplete function instead. 529 // Returns the desired percentage between the start and end values 530 531 return start + (end - start) * (percentage / 100); 532 }, 533 534 _onTimerTick: function() { 535 // Handler for the tick event to move the animation along through its duration 536 this._updatePercentComplete(this._percentComplete + this._percentDelta, true); 537 }, 538 539 _updatePercentComplete: function(percentComplete, animate) { 540 // Update the animation and its target given the current percentage of its duration that 541 // has already elapsed 542 // 543 // "percentComplete" - percentage of the animation duration that has already elapsed 544 // "animate" - whether or not updating the animation should visually modify the animation's target 545 546 if(percentComplete > 100) { 547 percentComplete = 100; 548 } 549 550 this._percentComplete = percentComplete; 551 this.raisePropertyChanged('percentComplete'); 552 553 if(animate) { 554 this.onStep(percentComplete); 555 } 556 557 if(percentComplete === 100) { 558 this.stop(false); 559 } 560 }, 561 562 /// <summary> 563 /// Makes this animation the child of another animation. 564 /// </summary> 565 /// <member name="cM:AjaxControlToolkit.Animation.setOwner" /> 566 /// <param name="owner" type="Object">Parent animation.</param> 567 setOwner: function(owner) { 568 this._owner = owner; 569 }, 570 571 ///<summary> 572 /// Occurs each time before animation starts playing. 573 ///</summary> 574 ///<member name="cE:AjaxControlToolkit.Animation.started" /> 575 ///<event add="add_started" remove="remove_started" raise="raise_started" /> 576 add_started: function(handler) { 577 this.get_events().addHandler("started", handler); 578 }, 579 remove_started: function(handler) { 580 this.get_events().removeHandler("started", handler); 581 }, 582 raise_started: function() { 583 var handlers = this.get_events().getHandler('started'); 584 if(handlers) 585 handlers(this, Sys.EventArgs.Empty); 586 }, 587 raiseStarted: function() { 588 Sys.Extended.Deprecated("raiseStarted()", "raise_started()"); 589 this.raise_started(); 590 }, 591 592 ///<summary> 593 /// Occurs each time after animation stops playing. 594 ///</summary> 595 ///<member name="cE:AjaxControlToolkit.Animation.ended" /> 596 ///<event add="add_ended" remove="remove_ended" raise="raise_ended" /> 597 add_ended: function(handler) { 598 this.get_events().addHandler("ended", handler); 599 }, 600 remove_ended: function(handler) { 601 this.get_events().removeHandler("ended", handler); 602 }, 603 raise_ended: function() { 604 var handlers = this.get_events().getHandler('ended'); 605 if(handlers) 606 handlers(this, Sys.EventArgs.Empty); 607 }, 608 raiseEnded: function() { 609 Sys.Extended.Deprecated("raiseEnded()", "raise_ended()"); 610 this.raise_ended(); 611 }, 612 613 ///<summary> 614 /// Occurs on animation's each frame. 615 ///</summary> 616 ///<member name="cE:AjaxControlToolkit.Animation.step" /> 617 ///<event add="add_step" remove="remove_step" raise="raise_step" /> 618 add_step: function(handler) { 619 this.get_events().addHandler("step", handler); 620 }, 621 remove_step: function(handler) { 622 this.get_events().removeHandler("step", handler); 623 }, 624 raise_step: function() { 625 var handlers = this.get_events().getHandler('step'); 626 if(handlers) 627 handlers(this, Sys.EventArgs.Empty); 628 }, 629 raiseStep: function() { 630 Sys.Extended.Deprecated("raiseStep()", "raise_step()"); 631 this.raise_ended(); 632 }, 633 634 get_target: function() { 635 if(!this._target && this._parentAnimation) { 636 return this._parentAnimation.get_target(); 637 } 638 return this._target; 639 }, 640 set_target: function(value) { 641 if(this._target != value) { 642 this._target = value; 643 this.raisePropertyChanged('target'); 644 } 645 }, 646 647 /// <summary> 648 /// Set the animation target by its identifier. 649 /// </summary> 650 /// <member name="cM:AjaxControlToolkit.Animation.setAnimationTarget" /> 651 /// <param name="id" type="Object">ID of a Sys.UI.DomElement or Sys.UI.Control to use as the target of the animation 652 /// If no Sys.UI.DomElement or Sys.UI.Control can be found for the given ID, an 653 /// argument exception will be thrown.</param> 654 setAnimationTarget: function(id) { 655 // Try to find a Sys.UI.DomElement 656 var target = null; 657 var element = $get(id); 658 if(element) { 659 target = element; 660 } else { 661 // Try to find the control in the AJAX controls collection 662 var ctrl = $find(id); 663 if(ctrl) {
664 element = ctrl.get_element(); 665 if(element) { 666 target = element; 667 } 668 } 669 } 670 671 // Use the new target if we have one, or raise an error if not 672 if(target) { 673 this.set_target(target); 674 } else { 675 throw Error.argument('id', String.format(Sys.Extended.UI.Resources.Animation_TargetNotFound, id)); 676 } 677 }, 678 set_animationTarget: function(id) { 679 Sys.Extended.Deprecated("setAnimationTarget(id)", "set_animationTarget(id)"); 680 this.setAnimationTarget(id); 681 }, 682 683 get_duration: function() { 684 return this._duration; 685 }, 686 set_duration: function(value) { 687 value = this._getFloat(value); 688 if(this._duration != value) { 689 this._duration = value; 690 this.raisePropertyChanged('duration'); 691 } 692 }, 693 694 get_fps: function() { 695 return this._fps; 696 }, 697 set_fps: function(value) { 698 value = this._getInteger(value); 699 if(this.fps != value) { 700 this._fps = value; 701 this.raisePropertyChanged('fps'); 702 } 703 }, 704 705 ///<summary> 706 /// A boolean value that determines whether or not animation is active. 707 ///</summary> 708 ///<getter>get_isActive</getter> 709 ///<member name="cP:AjaxControlToolkit.Animation.isActive" /> 710 get_isActive: function() { 711 return (this._timer !== null); 712 }, 713 714 ///<summary> 715 /// A boolean value that determines whether or not animation is currently playing. 716 ///</summary> 717 ///<getter>get_isPlaying</getter> 718 ///<member name="cP:AjaxControlToolkit.Animation.isPlaying" /> 719 get_isPlaying: function() { 720 return (this._timer !== null) && this._timer.get_enabled(); 721 }, 722 723 get_percentComplete: function() { 724 return this._percentComplete; 725 }, 726 727 _getBoolean: function(value) { 728 if(String.isInstanceOfType(value)) { 729 return Boolean.parse(value); 730 } 731 return value; 732 }, 733 734 _getInteger: function(value) { 735 if(String.isInstanceOfType(value)) { 736 return parseInt(value); 737 } 738 return value; 739 }, 740 741 _getFloat: function(value) { 742 if(String.isInstanceOfType(value)) { 743 return parseFloat(value); 744 } 745 return value; 746 }, 747 748 _getEnum: function(value, type) { 749 // Helper to convert strings to enum values for property setters 750 // Returns value that has been converted if it was a string 751 // 752 // "value" - value to convert if it's a string 753 // "type" - type of the enum to convert to 754 755 if(String.isInstanceOfType(value) && type && type.parse) { 756 return type.parse(value); 757 } 758 return value; 759 } 760} 761$AA.Animation.registerClass('Sys.Extended.UI.Animation.Animation', Sys.Component); 762$AA.registerAnimation('animation', $AA.Animation); 763 764///<summary> 765/// The ParentAnimation serves as a base class for all animations that contain children (such as 766/// Sys.Extended.UI.Animation.ParallelAnimation, Sys.Extended.UI.SequenceAnimation, 767/// etc.). It does not actually play the animations, so any classes that inherit from it must do so. Any animation 768/// that requires nested child animations must inherit from this class, although it will likely want to inherit off of 769/// Sys.Extended.UI.Animation.ParallelAnimation or Sys.Extended.UI.SequenceAnimation 770/// which will actually play their child animations. 771///</summary> 772///<member name="cT:AjaxControlToolkit.ParentAnimation" base="AjaxControlToolkit.Animation" /> 773 774/// <summary /> 775/// <member name="cM:AjaxControlToolkit.ParentAnimation.ctor" /> 776/// <param name="target" type="Object">Target of the animation.</param> 777/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 778/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 779/// <param name="animations" type="Object">Array of child animations to be played.</param> 780$AA.ParentAnimation = function(target, duration, fps, animations) { 781 $AA.ParentAnimation.initializeBase(this, [target, duration, fps]); 782 783 this._animations = []; 784 785 // Add any child animations passed into the constructor 786 if(animations && animations.length) { 787 for(var i = 0; i < animations.length; i++) { 788 this.add(animations[i]); 789 } 790 } 791} 792$AA.ParentAnimation.prototype = { 793 initialize: function() { 794 // Initialize the parent along with any child animations that have not yet been initialized themselves 795 $AA.ParentAnimation.callBaseMethod(this, 'initialize'); 796 797 // Initialize all the uninitialized child animations 798 if(this._animations) { 799 for(var i = 0; i < this._animations.length; i++) { 800 var animation = this._animations[i]; 801 if(animation && !animation.get_isInitialized) { 802 animation.initialize(); 803 } 804 } 805 } 806 }, 807 808 dispose: function() { 809 this.clear(); 810 this._animations = null; 811 $AA.ParentAnimation.callBaseMethod(this, 'dispose'); 812 }, 813 814 ///<summary> 815 /// Array of child animations to be played (there are no assumptions placed on order because it will matter for some 816 /// derived animations like Sys.Extended.UI.Animation.SequenceAnimation, but not for 817 /// others like Sys.Extended.UI.Animation.ParallelAnimation). To manipulate the child 818 /// animations, use the functions add, clear, remove, and removeAt. 819 ///</summary> 820 ///<getter>get_target</getter> 821 ///<member name="cP:AjaxControlToolkit.ParentAnimation.animations" /> 822 get_animations: function() { 823 return this._animations; 824 }, 825 826 /// <summary> 827 /// Add an animation as a child of this animation. 828 /// </summary> 829 /// <member name="cM:AjaxControlToolkit.ParentAnimation.add" /> 830 /// <param name="animation" type="Object">Child animation to add.</param> 831 add: function(animation) { 832 if(this._animations) { 833 if(animation) { 834 animation._parentAnimation = this; 835 } 836 Array.add(this._animations, animation); 837 this.raisePropertyChanged('animations'); 838 } 839 }, 840 841 /// <summary> 842 /// Remove the animation from the array of child animations. 843 /// This will dispose the removed animation. 844 /// </summary> 845 /// <member name="cM:AjaxControlToolkit.ParentAnimation.remove" /> 846 /// <param name="animation" type="Object">Child animation to remove.</param> 847 remove: function(animation) { 848 if(this._animations) { 849 if(animation) { 850 animation.dispose(); 851 } 852 Array.remove(this._animations, animation); 853 this.raisePropertyChanged('animations'); 854 } 855 }, 856 857 /// <summary> 858 /// Remove the animation at a given index from the array of child animations. 859 /// </summary> 860 /// <member name="cM:AjaxControlToolkit.ParentAnimation.removeAt" /> 861 /// <param name="index" type="Number">Index of the child animation to remove.</param> 862 removeAt: function(index) { 863 if(this._animations) { 864 var animation = this._animations[index]; 865 if(animation) { 866 animation.dispose(); 867 } 868 Array.removeAt(this._animations, index); 869 this.raisePropertyChanged('animations'); 870 } 871 }, 872 873 /// <summary> 874 /// Clear the array of child animations. 875 /// This will dispose the cleared child animations. 876 /// </summary> 877 /// <member name="cM:AjaxControlToolkit.ParentAnimation.clear" /> 878 clear: function() { 879 if(this._animations) { 880 for(var i = this._animations.length - 1; i >= 0; i--) { 881 this._animations[i].dispose(); 882 this._animations[i] = null; 883 } 884 Array.clear(this._animations); 885 this._animations = []; 886 this.raisePropertyChanged('animations'); 887 } 888 } 889} 890$AA.ParentAnimation.registerClass('Sys.Extended.UI.Animation.ParentAnimation', $AA.Animation); 891$AA.registerAnimation('parent', $AA.ParentAnimation); 892 893///<summary> 894/// The ParallelAnimation plays several animations simultaneously. It inherits from 895/// Sys.Extended.UI.Animation.ParentAnimation, but makes itself the owner of all
896/// its child animations to allow the use a single timer and syncrhonization mechanisms shared with 897/// all the children (in other words, the duration properties of any child animations 898/// are ignored in favor of the parent's duration). It is very useful in creating 899/// sophisticated effects through combination of simpler animations. 900///</summary> 901///<member name="cT:AjaxControlToolkit.ParallelAnimation" base="AjaxControlToolkit.ParentAnimation" /> 902 903/// <summary /> 904/// <member name="cM:AjaxControlToolkit.ParallelAnimation.ctor" /> 905/// <param name="target" type="Object">Target of the animation.</param> 906/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 907/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 908/// <param name="animations" type="Object">Array of child animations.</param> 909$AA.ParallelAnimation = function(target, duration, fps, animations) { 910 $AA.ParallelAnimation.initializeBase(this, [target, duration, fps, animations]); 911} 912$AA.ParallelAnimation.prototype = { 913 /// <summary> 914 /// Add an animation as a child of this animation and make ourselves its owner. 915 /// </summary> 916 /// <member name="cM:AjaxControlToolkit.ParallelAnimation.add" /> 917 /// <param name="animation" type="Object">Child animation to add.</param> 918 add: function(animation) { 919 $AA.ParallelAnimation.callBaseMethod(this, 'add', [animation]); 920 animation.setOwner(this); 921 }, 922 923 /// <summary> 924 /// Get the child animations ready to play. 925 /// </summary> 926 /// <member name="cM:AjaxControlToolkit.ParallelAnimation.onStart" /> 927 onStart: function() { 928 $AA.ParallelAnimation.callBaseMethod(this, 'onStart'); 929 var animations = this.get_animations(); 930 for(var i = 0; i < animations.length; i++) { 931 animations[i].onStart(); 932 } 933 }, 934 935 /// <summary> 936 /// Progress the child animations through each frame. 937 /// </summary> 938 /// <member name="cM:AjaxControlToolkit.ParallelAnimation.onStart" /> 939 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 940 onStep: function(percentage) { 941 var animations = this.get_animations(); 942 for(var i = 0; i < animations.length; i++) { 943 animations[i].onStep(percentage); 944 } 945 }, 946 947 /// <summary> 948 /// Finish playing all of the child animations. 949 /// </summary> 950 /// <member name="cM:AjaxControlToolkit.ParallelAnimation.onEnd" /> 951 onEnd: function() { 952 var animations = this.get_animations(); 953 for(var i = 0; i < animations.length; i++) { 954 animations[i].onEnd(); 955 } 956 $AA.ParallelAnimation.callBaseMethod(this, 'onEnd'); 957 } 958} 959$AA.ParallelAnimation.registerClass('Sys.Extended.UI.Animation.ParallelAnimation', $AA.ParentAnimation); 960$AA.registerAnimation('parallel', $AA.ParallelAnimation); 961 962///<summary> 963/// The SequenceAnimation runs several animations one after the other. It can also 964/// repeat the sequence of animations for a specified number of iterations (which defaults to a 965/// single iteration, but will repeat forever if you specify zero or less iterations). Also, the 966/// SequenceAnimation cannot be a child of a Sys.Extended.UI.Animation.ParallelAnimation 967/// (or any animation inheriting from it). 968///</summary> 969///<member name="cT:AjaxControlToolkit.SequenceAnimation" base="AjaxControlToolkit.ParentAnimation" /> 970 971/// <summary> 972/// The SequenceAnimation ignores the duration and fps 973/// properties, and will let each of its child animations use any settings they please. 974/// </summary> 975/// <member name="cM:AjaxControlToolkit.SequenceAnimation.ctor" /> 976/// <param name="target" type="Object">Target of the animation.</param> 977/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 978/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 979/// <param name="animations" type="Object">Array of child animations.</param> 980/// <param name="iterations" type="Number">Number of times to repeatedly play the sequence. If zero or less iterations are specified, the sequence 981/// will repeat forever. The default value is 1 iteration.</param> 982$AA.SequenceAnimation = function(target, duration, fps, animations, iterations) { 983 $AA.SequenceAnimation.initializeBase(this, [target, duration, fps, animations]); 984 985 // Handler used to determine when an animation has finished 986 this._handler = null; 987 988 // Flags to note whether we're playing, paused, or stopped 989 this._paused = false;
990 this._playing = false; 991 992 // Index of the currently executing animation in the sequence 993 this._index = 0; 994 995 // Counter used when playing the animation to determine the remaining number of times to play the entire sequence 996 this._remainingIterations = 0; 997 998 ///<summary> 999 /// Number of times to repeatedly play the sequence. If zero or less iterations are specified, the sequence 1000 /// will repeat forever. The default value is 1 iteration. 1001 ///</summary> 1002 ///<getter>get_iterations</getter> 1003 ///<setter>set_iterations</setter> 1004 ///<member name="cP:AjaxControlToolkit.SequenceAnimation.iterations" /> 1005 this._iterations = (iterations !== undefined) ? iterations : 1; 1006} 1007$AA.SequenceAnimation.prototype = { 1008 dispose: function() { 1009 this._handler = null; 1010 $AA.SequenceAnimation.callBaseMethod(this, 'dispose'); 1011 }, 1012 1013 /// <summary> 1014 /// Stop playing the entire sequence of animations. 1015 /// </summary> 1016 /// <remarks> 1017 /// Stopping this animation will perform the last step of each child animation, thereby leaving their 1018 /// target elements in a state consistent with the animation playing completely. If this animation is 1019 /// the child of another, you must call stop on its parent instead. 1020 /// </remarks> 1021 /// <member name="cM:AjaxControlToolkit.SequenceAnimation.stop" /> 1022 stop: function() { 1023 if(this._playing) { 1024 var animations = this.get_animations(); 1025 if(this._index < animations.length) { 1026 // Remove the handler from the currently running animation 1027 animations[this._index].remove_ended(this._handler); 1028 // Call stop on all remaining animations to ensure their 1029 // effects will be seen 1030 for(var i = this._index; i < animations.length; i++) { 1031 animations[i].stop(); 1032 } 1033 } 1034 this._playing = false; 1035 this._paused = false; 1036 this.raisePropertyChanged('isPlaying'); 1037 this.onEnd(); 1038 } 1039 }, 1040 1041 /// <summary> 1042 /// Pause the animation if it is playing. Calling play will resume where 1043 /// the animation left off. 1044 /// </summary> 1045 /// <remarks> 1046 /// If this animation is the child of another, you must call pause on its parent instead. 1047 /// </remarks> 1048 /// <member name="cM:AjaxControlToolkit.SequenceAnimation.pause" /> 1049 pause: function() { 1050 if(this.get_isPlaying()) { 1051 var current = this.get_animations()[this._index]; 1052 if(current != null) { 1053 current.pause(); 1054 } 1055 this._paused = true; 1056 this.raisePropertyChanged('isPlaying'); 1057 } 1058 }, 1059 1060 /// <summary> 1061 /// Play the sequence of animations from the beginning or where it was left off when paused. 1062 /// </summary> 1063 /// <remarks> 1064 /// If this animation is the child of another, you must call play on its parent instead. 1065 /// </remarks> 1066 /// <member name="cM:AjaxControlToolkit.SequenceAnimation.play" /> 1067 play: function() { 1068 var animations = this.get_animations(); 1069 if(!this._playing) { 1070 this._playing = true; 1071 if(this._paused) { 1072 this._paused = false; 1073 var current = animations[this._index]; 1074 if(current != null) { 1075 current.play(); 1076 this.raisePropertyChanged('isPlaying'); 1077 } 1078 } else { 1079 this.onStart(); 1080 // Reset the index and attach the handler to the first 1081 this._index = 0; 1082 var first = animations[this._index]; 1083 if(first) { 1084 first.add_ended(this._handler); 1085 first.play(); 1086 this.raisePropertyChanged('isPlaying'); 1087 } else { 1088 this.stop(); 1089 } 1090 } 1091 } 1092 }, 1093 1094 /// <summary> 1095 /// The onStart method is called just before the animation is played each time. 1096 /// </summary> 1097 /// <member name="cM:AjaxControlToolkit.SequenceAnimation.onStart" /> 1098 onStart: function() { 1099 $AA.SequenceAnimation.callBaseMethod(this, 'onStart'); 1100 this._remainingIterations = this._iterations - 1; 1101 1102 // Create the handler we attach to each animation as it plays to determine when we've finished with it 1103 if(!this._handler) { 1104 this._handler = Function.createDelegate(this, this._onEndAnimation); 1105 } 1106 }, 1107 1108 _onEndAnimation: function() { 1109 // Wait for the end of each animation, and then continue by playing the other animations remaining 1110 // in the sequence. Stop when it reaches the last animation and there are no remaining iterations. 1111 1112 // Remove the handler from the current animation 1113 var animations = this.get_animations(); 1114 var current = animations[this._index++]; 1115 if(current) { 1116 current.remove_ended(this._handler); 1117 } 1118 1119 // Keep running animations and stop when we're out 1120 if(this._index < animations.length) { 1121 var next = animations[this._index]; 1122 next.add_ended(this._handler); 1123 next.play(); 1124 } else if(this._remainingIterations >= 1 || this._iterations <= 0) { 1125 this._remainingIterations--; 1126 this._index = 0; 1127 var first = animations[0]; 1128 first.add_ended(this._handler); 1129 first.play(); 1130 } else { 1131 this.stop(); 1132 } 1133 }, 1134 1135 /// <summary>
1136 /// Raises an invalid operation exception because this will only be called if a SequenceAnimation 1137 /// has been nested inside an Sys.Extended.UI.Animation.ParallelAnimation (or a derived type). 1138 /// </summary> 1139 /// <member name="cM:AjaxControlToolkit.SequenceAnimation.onStep" /> 1140 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 1141 onStep: function(percentage) { 1142 throw Error.invalidOperation(Sys.Extended.UI.Resources.Animation_CannotNestSequence); 1143 }, 1144 1145 /// <summary> 1146 /// The onEnd method is called just after the animation is played each time. 1147 /// </summary> 1148 /// <member name="cM:AjaxControlToolkit.SequenceAnimation.onEnd" /> 1149 onEnd: function() { 1150 this._remainingIterations = 0; 1151 $AA.SequenceAnimation.callBaseMethod(this, 'onEnd'); 1152 }, 1153 1154 get_isActive: function() { 1155 return true; 1156 }, 1157 1158 get_isPlaying: function() { 1159 return this._playing && !this._paused; 1160 }, 1161 1162 get_iterations: function() { 1163 return this._iterations; 1164 }, 1165 set_iterations: function(value) { 1166 value = this._getInteger(value); 1167 if(this._iterations != value) { 1168 this._iterations = value; 1169 this.raisePropertyChanged('iterations'); 1170 } 1171 }, 1172 1173 ///<summary> 1174 /// A boolean value that determines whether or not animation runs in an infinite loop until it is explicitly stopped. 1175 ///</summary> 1176 ///<getter>get_isInfinite</getter> 1177 ///<member name="cP:AjaxControlToolkit.SequenceAnimation.isInfinite" /> 1178 get_isInfinite: function() { 1179 return this._iterations <= 0; 1180 } 1181} 1182$AA.SequenceAnimation.registerClass('Sys.Extended.UI.Animation.SequenceAnimation', $AA.ParentAnimation); 1183$AA.registerAnimation('sequence', $AA.SequenceAnimation); 1184 1185///<summary> 1186/// The SelectionAnimation will run a single animation chosen from of its child animations. It is 1187/// important to note that the SelectionAnimation ignores the duration and fps 1188/// properties, and will let each of its child animations use any settings they please. This is a base class with no 1189/// functional implementation, so consider using ConditionAnimation or CaseAnimation instead. 1190///</summary> 1191///<member name="cT:AjaxControlToolkit.SelectionAnimation" base="AjaxControlToolkit.ParentAnimation" /> 1192 1193/// <summary /> 1194/// <member name="cM:AjaxControlToolkit.SelectionAnimation.ctor" /> 1195/// <param name="target" type="Object">Target of the animation.</param> 1196/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1197/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1198/// <param name="animations" type="Object">Array of child animations to be played.</param> 1199$AA.SelectionAnimation = function(target, duration, fps, animations) { 1200 $AA.SelectionAnimation.initializeBase(this, [target, duration, fps, animations]); 1201 1202 // Index of the animation selected to play 1203 this._selectedIndex = -1; 1204 1205 // Reference to the animation selected to play 1206 this._selected = null; 1207} 1208$AA.SelectionAnimation.prototype = { 1209 /// <summary> 1210 /// Get the index of the animation that is selected to be played. If this returns an index outside the bounds of 1211 /// the child animations array, then nothing is played. 1212 /// </summary> 1213 /// <member name="cM:AjaxControlToolkit.SelectionAnimation.getSelectedIndex" /> 1214 getSelectedIndex: function() { 1215 throw Error.notImplemented(); 1216 }, 1217 1218 /// <summary> 1219 /// The onStart method is called just before the animation is played each time. 1220 /// </summary> 1221 /// <member name="cM:AjaxControlToolkit.SelectionAnimation.onStart" /> 1222 onStart: function() { 1223 $AA.SelectionAnimation.callBaseMethod(this, 'onStart'); 1224 1225 var animations = this.get_animations(); 1226 this._selectedIndex = this.getSelectedIndex(); 1227 if(this._selectedIndex >= 0 && this._selectedIndex < animations.length) { 1228 this._selected = animations[this._selectedIndex]; 1229 if(this._selected) { 1230 this._selected.setOwner(this); 1231 this._selected.onStart(); 1232 } 1233 } 1234 }, 1235 1236 /// <summary> 1237 /// The onStep method is called repeatedly to progress the animation through each frame. 1238 /// </summary> 1239 /// <member name="cM:AjaxControlToolkit.SelectionAnimation.onStep" /> 1240 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 1241 onStep: function(percentage) { 1242 if(this._selected) { 1243 this._selected.onStep(percentage); 1244 } 1245 }, 1246 1247 /// <summary> 1248 /// The onEnd method is called just after the animation is played each time. 1249 /// </summary> 1250 /// <member name="cM:AjaxControlToolkit.SelectionAnimation.onEnd" /> 1251 onEnd: function() { 1252 if(this._selected) { 1253 this._selected.onEnd(); 1254 this._selected.setOwner(null); 1255 } 1256 this._selected = null; 1257 this._selectedIndex = null; 1258 $AA.SelectionAnimation.callBaseMethod(this, 'onEnd'); 1259 } 1260} 1261$AA.SelectionAnimation.registerClass('Sys.Extended.UI.Animation.SelectionAnimation', $AA.ParentAnimation); 1262$AA.registerAnimation('selection', $AA.SelectionAnimation); 1263 1264///<summary> 1265/// The ConditionAnimation is used as a control structure to play a specific child animation
1266/// depending on the result of executing the conditionScript. If the conditionScript 1267/// evaluates to true, the first child animation is played. If it evaluates to false, 1268/// the second child animation is played (although nothing is played if a second animation is not present). 1269///</summary> 1270///<member name="cT:AjaxControlToolkit.ConditionAnimation" base="AjaxControlToolkit.SelectionAnimation" /> 1271 1272/// <summary /> 1273/// <member name="cM:AjaxControlToolkit.ConditionAnimation.ctor" /> 1274/// <param name="target" type="Object">Target of the animation.</param> 1275/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1276/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1277/// <param name="animations" type="Object">Array of child animations to be played.</param> 1278/// <param name="conditionScript" type="Object">JavaScript that should evaluate to true or false to determine which child 1279/// animation to play.</param> 1280$AA.ConditionAnimation = function(target, duration, fps, animations, conditionScript) { 1281 $AA.ConditionAnimation.initializeBase(this, [target, duration, fps, animations]); 1282 1283 // Condition to determine which index we will play 1284 this._conditionScript = conditionScript; 1285} 1286$AA.ConditionAnimation.prototype = { 1287 /// <summary> 1288 /// Get the index of the animation that is selected to be played. If this returns an index outside the bounds of 1289 /// the child animations array, then nothing is played. 1290 /// </summary> 1291 /// <member name="cM:AjaxControlToolkit.ConditionAnimation.getSelectedIndex" /> 1292 getSelectedIndex: function() { 1293 var selected = -1; 1294 if(this._conditionScript && this._conditionScript.length > 0) { 1295 try { 1296 selected = eval(this._conditionScript) ? 0 : 1; 1297 } catch(ex) { 1298 } 1299 } 1300 return selected; 1301 }, 1302 1303 /// <summary> 1304 /// JavaScript that should evaluate to true or false to determine which 1305 /// child animation to play. 1306 /// </summary> 1307 /// <getter>get_conditionScript</getter> 1308 /// <setter>set_conditionScript</setter> 1309 /// <member name="cP:AjaxControlToolkit.ConditionAnimation.conditionScript" /> 1310 get_conditionScript: function() { 1311 return this._conditionScript; 1312 }, 1313 set_conditionScript: function(value) { 1314 if(this._conditionScript != value) { 1315 this._conditionScript = value; 1316 this.raisePropertyChanged('conditionScript'); 1317 } 1318 } 1319} 1320$AA.ConditionAnimation.registerClass('Sys.Extended.UI.Animation.ConditionAnimation', $AA.SelectionAnimation); 1321$AA.registerAnimation('condition', $AA.ConditionAnimation); 1322 1323///<summary> 1324/// The CaseAnimation is used as a control structure to play a specific child animation depending on 1325/// the result of executing the selectScript, which should return the index of the child animation to 1326/// play (this is similar to the case or select statements in C#/VB, etc.). If the provided 1327/// index is outside the bounds of the child animations array (or if nothing was returned) then we will not play anything. 1328///</summary> 1329///<member name="cT:AjaxControlToolkit.CaseAnimation" base="AjaxControlToolkit.SelectionAnimation" /> 1330 1331/// <summary /> 1332/// <member name="cM:AjaxControlToolkit.CaseAnimation.ctor" /> 1333/// <param name="target" type="Object">Target of the animation.</param> 1334/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1335/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1336/// <param name="animations" type="Object">Array of child animations to be played.</param> 1337/// <param name="selectScript" type="Object">JavaScript that should evaluate to the index of the appropriate child animation to play. 1338/// If this returns an index outside the bounds of the child animations array, then nothing is played.</param> 1339$AA.CaseAnimation = function(target, duration, fps, animations, selectScript) { 1340 $AA.CaseAnimation.initializeBase(this, [target, duration, fps, animations]); 1341 1342 // Condition to determine which index we will play 1343 this._selectScript = selectScript; 1344} 1345$AA.CaseAnimation.prototype = { 1346 /// <summary> 1347 /// Get the index of the animation that is selected to be played. If this returns an index outside the bounds of 1348 /// the child animations array, then nothing is played. 1349 /// </summary> 1350 /// <member name="cM:AjaxControlToolkit.CaseAnimation.getSelectedIndex" /> 1351 getSelectedIndex: function() { 1352 var selected = -1; 1353 if(this._selectScript && this._selectScript.length > 0) { 1354 try { 1355 var result = eval(this._selectScript) 1356 if(result !== undefined) 1357 selected = result; 1358 } catch(ex) { 1359 } 1360 } 1361 return selected; 1362 }, 1363 1364 /// <summary> 1365 /// JavaScript that should evaluate to the index of the appropriate child animation to play. 1366 /// If this returns an index outside the bounds of the child animations array, then nothing is played. 1367 /// </summary> 1368 /// <getter>get_selectScript</getter> 1369 /// <setter>set_selectScript</setter> 1370 /// <member name="cP:AjaxControlToolkit.CaseAnimation.selectScript" /> 1371 get_selectScript: function() { 1372 return this._selectScript; 1373 }, 1374 set_selectScript: function(value) { 1375 if(this._selectScript != value) { 1376 this._selectScript = value; 1377 this.raisePropertyChanged('selectScript'); 1378 } 1379 } 1380} 1381$AA.CaseAnimation.registerClass('Sys.Extended.UI.Animation.CaseAnimation', $AA.SelectionAnimation); 1382$AA.registerAnimation('case', $AA.CaseAnimation); 1383 1384 1385$AA.FadeEffect = function() { 1386 // The FadeEffect enumeration determines whether a fade animation is used to fade in or fade out.
1387 throw Error.invalidOperation(); 1388} 1389$AA.FadeEffect.prototype = { 1390 FadeIn: 0, 1391 FadeOut: 1 1392} 1393$AA.FadeEffect.registerEnum("Sys.Extended.UI.Animation.FadeEffect", false); 1394 1395///<summary> 1396/// The FadeAnimation is used to fade an element in or out of view, depending on the 1397/// provided Sys.Extended.UI.Animation.FadeEffect, by settings its opacity. 1398/// The minimum and maximum opacity values can be specified to precisely control the fade. 1399/// You may also consider using FadeInAnimation or FadeOutAnimation if you know the only direction you 1400/// are fading. 1401///</summary> 1402///<member name="cT:AjaxControlToolkit.FadeAnimation" base="AjaxControlToolkit.Animation" /> 1403 1404/// <summary /> 1405/// <member name="cM:AjaxControlToolkit.FadeAnimation.ctor" /> 1406/// <param name="target" type="Object">Length of the animation in seconds. The default is 1.</param> 1407/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1408/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1409/// <param name="effect" type="Object">determine whether to fade the element in or fade the element out. The possible values are FadeIn 1410/// and FadeOut. The default value is FadeOut.</param> 1411/// <param name="minimumOpacity" type="Number">Minimum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 0.</param> 1412/// <param name="maximumOpacity" type="Number">Maximum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 1.</param> 1413/// <param name="forceLayoutInIE" type="Boolean">whether or not we should force a layout to be created for Internet Explorer by giving it a width and setting its 1414/// background color (the latter is required in case the user has ClearType enabled). The default value is true. 1415/// This is obviously ignored when working in other browsers.</param> 1416$AA.FadeAnimation = function(target, duration, fps, effect, minimumOpacity, maximumOpacity, forceLayoutInIE) { 1417 $AA.FadeAnimation.initializeBase(this, [target, duration, fps]); 1418 1419 // The effect determines whether or not we fade in or out 1420 this._effect = (effect !== undefined) ? effect : $AA.FadeEffect.FadeIn; 1421 1422 // Maximum and minimum opacities default to 100% and 0% 1423 this._max = (maximumOpacity !== undefined) ? maximumOpacity : 1; 1424 this._min = (minimumOpacity !== undefined) ? minimumOpacity : 0; 1425 1426 // Starting and ending opacities 1427 this._start = this._min; 1428 this._end = this._max; 1429 1430 // Whether the a layout has already been created (to work around IE 1431 // problems). 1432 this._layoutCreated = false; 1433 1434 // Whether or not we should force a layout to be created for IE by giving it a width 1435 // and setting its background color (the latter is required in case the user has ClearType enabled). 1436 // http://msdn.microsoft.com/library/default.asp?url=/workshop/author/filter/reference/filters/alpha.asp 1437 this._forceLayoutInIE = (forceLayoutInIE === undefined || forceLayoutInIE === null) ? true : forceLayoutInIE; 1438 1439 // Current target of the animation that is cached before the animation plays (since looking up 1440 // the target could mean walking all the way up to the root of the animation's tree, which we don't 1441 // want to do for every step of the animation) 1442 this._currentTarget = null; 1443 1444 // Properly set up the min/max values provided by the constructor 1445 this._resetOpacities(); 1446} 1447$AA.FadeAnimation.prototype = { 1448 _resetOpacities: function() { 1449 // Set the starting and ending opacity values based on the effect (i.e. when we're fading 1450 // in we go from _min to _max, but we go _max to 1451 // _min when fading out) 1452 1453 if(this._effect == $AA.FadeEffect.FadeIn) { 1454 this._start = this._min; 1455 this._end = this._max; 1456 } else { 1457 this._start = this._max; 1458 this._end = this._min; 1459 } 1460 }, 1461 1462 _createLayout: function() { 1463 // Create a layout when using Internet Explorer (which entails setting a width and also 1464 // a background color if it currently has neither) 1465 1466 var element = this._currentTarget; 1467 if(element) { 1468 // Get the original width/height/back color 1469 this._originalWidth = $common.getCurrentStyle(element, 'width'); 1470 var originalHeight = $common.getCurrentStyle(element, 'height'); 1471 this._originalBackColor = $common.getCurrentStyle(element, 'backgroundColor'); 1472 1473 // Set the width which will force the creation of a layout 1474 if((!this._originalWidth || this._originalWidth == '' || this._originalWidth == 'auto') && 1475 (!originalHeight || originalHeight == '' || originalHeight == 'auto')) { 1476 element.style.width = element.offsetWidth + 'px'; 1477 } 1478 1479 // Set the back color to avoid ClearType problems 1480 if(!this._originalBackColor || this._originalBackColor == '' || this._originalBackColor == 'transparent' || this._originalBackColor == 'rgba(0, 0, 0, 0)') { 1481 element.style.backgroundColor = $common.getInheritedBackgroun
1481dColor(element); 1482 } 1483 1484 // Mark that we've created the layout so we only do it once 1485 this._layoutCreated = true; 1486 } 1487 }, 1488 1489 /// <summary> 1490 /// The onStart method is called just before the animation is played each time. 1491 /// </summary> 1492 /// <member name="cM:AjaxControlToolkit.FadeAnimation.onStart" /> 1493 onStart: function() { 1494 $AA.FadeAnimation.callBaseMethod(this, 'onStart'); 1495 1496 this._currentTarget = this.get_target(); 1497 this.setValue(this._start); 1498 1499 // Force the creation of a layout in IE if we're supposed to and the current browser is Internet Explorer 1500 if(this._forceLayoutInIE && !this._layoutCreated && Sys.Browser.agent == Sys.Browser.InternetExplorer) { 1501 this._createLayout(); 1502 } 1503 }, 1504 1505 /// <summary> 1506 /// Determine the current opacity after the given percentage of its duration has elapsed. 1507 /// </summary> 1508 /// <member name="cM:AjaxControlToolkit.FadeAnimation.getAnimatedValue" /> 1509 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 1510 getAnimatedValue: function(percentage) { 1511 return this.interpolate(this._start, this._end, percentage); 1512 }, 1513 1514 /// <summary> 1515 /// Set the current opacity of the element. 1516 /// </summary> 1517 /// <member name="cM:AjaxControlToolkit.FadeAnimation.setValue" /> 1518 /// <param name="value" type="Number">Current opacity (as retreived from getAnimatedValue).</param> 1519 setValue: function(value) { 1520 // This method will be replaced by a dynamically generated function that requires no logic 1521 // to determine whether it should use filters or the style's opacity. 1522 if(this._currentTarget) { 1523 $common.setElementOpacity(this._currentTarget, value); 1524 } 1525 }, 1526 1527 ///<summary> 1528 /// Determine whether to fade the element in or fade the element out. The possible values are 1529 /// FadeIn and FadeOut. The default value is FadeOut. 1530 ///</summary> 1531 ///<getter>get_effect</getter> 1532 ///<setter>set_effect</setter> 1533 ///<member name="cP:AjaxControlToolkit.FadeAnimation.effect" /> 1534 get_effect: function() { 1535 return this._effect; 1536 }, 1537 set_effect: function(value) { 1538 value = this._getEnum(value, $AA.FadeEffect); 1539 if(this._effect != value) { 1540 this._effect = value; 1541 this._resetOpacities(); 1542 this.raisePropertyChanged('effect'); 1543 } 1544 }, 1545 1546 ///<summary> 1547 /// Minimum opacity to use when fading in or out. Its value can range from between 0 to 1. 1548 /// The default value is 0. 1549 ///</summary> 1550 ///<getter>get_minimumOpacity</getter> 1551 ///<setter>set_minimumOpacity</setter> 1552 ///<member name="cP:AjaxControlToolkit.FadeAnimation.minimumOpacity" /> 1553 get_minimumOpacity: function() { 1554 return this._min; 1555 }, 1556 set_minimumOpacity: function(value) { 1557 value = this._getFloat(value); 1558 if(this._min != value) { 1559 this._min = value; 1560 this._resetOpacities(); 1561 this.raisePropertyChanged('minimumOpacity'); 1562 } 1563 }, 1564 1565 ///<summary> 1566 /// Maximum opacity to use when fading in or out. Its value can range from between 0 to 1. 1567 /// The default value is 1. 1568 ///</summary> 1569 ///<getter>get_maximumOpacity</getter> 1570 ///<setter>set_maximumOpacity</setter> 1571 ///<member name="cP:AjaxControlToolkit.FadeAnimation.maximumOpacity" /> 1572 get_maximumOpacity: function() { 1573 return this._max; 1574 }, 1575 set_maximumOpacity: function(value) { 1576 value = this._getFloat(value); 1577 if(this._max != value) { 1578 this._max = value; 1579 this._resetOpacities(); 1580 this.raisePropertyChanged('maximumOpacity'); 1581 } 1582 }, 1583 1584 ///<summary> 1585 /// Whether or not we should force a layout to be created for Internet Explorer by giving it a width and setting its 1586 /// background color (the latter is required in case the user has ClearType enabled). The default value is true. 1587 /// This is obviously ignored when working in other browsers. 1588 ///</summary> 1589 ///<getter>get_forceLayoutInIE</getter> 1590 ///<setter>set_forceLayoutInIE</setter> 1591 ///<member name="cP:AjaxControlToolkit.FadeAnimation.forceLayoutInIE" /> 1592 get_forceLayoutInIE: function() { 1593 return this._forceLayoutInIE; 1594 }, 1595 set_forceLayoutInIE: function(value) { 1596 value = this._getBoolean(value); 1597 if(this._forceLayoutInIE != value) { 1598 this._forceLayoutInIE = value; 1599 this.raisePropertyChanged('forceLayoutInIE'); 1600 } 1601 }, 1602 1603 /// <summary> 1604 /// Set the start value (so that child animations can set the current opacity as the start value when fading in or out). 1605 /// </summary> 1606 /// <member name="cM:AjaxControlToolkit.FadeAnimation.setStartValue" /> 1607 /// <param name="value" type="Number">Opacity to start fade animation with.</param> 1608 setStartValue: function(value) { 1609 value = this._getFloat(value); 1610 this._start = value; 1611 }, 1612 set_startValue: function(value) { 1613 Sys.Extended.Deprecated("setStartValue(value)", "set_startValue(value)"); 1614 this.setStartValue(value); 1615 } 1616} 1617$AA.FadeAnimation.registerClass('Sys.Extended.UI.Animation.FadeAnimation', $AA.Animation); 1618$AA.registerAnimation('fade', $AA.FadeAnimation); 1619 1620///<summary> 1621/// The FadeInAnimation will fade the target in by moving from hidden to visible. 1622/// It starts the animation the target's current opacity. 1623///</summary> 1624///<member name="cT:AjaxControlToolkit.FadeInAnimation" base="AjaxControlToolkit.FadeAnimation" /> 1625 1626/// <summary /> 1627/// <member name="cM:AjaxControlToolkit.FadeInAnimation.ctor" /> 1628/// <param name="target" type="Object">Target of the animation.</param> 1629/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1630/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1631/// <param name="minimumOpacity" type="Number">Minimum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 0.</param> 1632/// <param name="maximumOpacity" type="Number">Maximum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 1.</param> 1633/// <param name="forceLayoutInIE" type="Boolean">whether or not we should force a layout to be created for Internet Explorer by giving it a width and setting its 1634/// background color (the latter is required in case the user has ClearType enabled). The default value is true. 1635/// This is obviously ignored when working in other browsers.</param> 1636$AA.FadeInAnimation = function(target, duration, fps, minimumOpacity, maximumOpacity, forceLayoutInIE) { 1637 $AA.FadeInAnimation.initializeBase(this, [target, duration, fps, $AA.FadeEffect.FadeIn, minimumOpacity, maximumOpacity, forceLayoutInIE]); 1638} 1639$AA.FadeInAnimation.prototype = { 1640 /// <summary> 1641 /// The onStart method is called just before the animation is played each time. 1642 /// </summary> 1643 /// <member name="cM:AjaxControlToolkit.FadeInAnimation.onStart" /> 1644 onStart: function() { 1645 $AA.FadeInAnimation.callBaseMethod(this, 'onStart'); 1646 1647 if(this._currentTarget) { 1648 this.set_startValue($common.getElementOpacity(this._currentTarget)); 1649 } 1650 } 1651} 1652$AA.FadeInAnimation.registerClass('Sys.Extended.UI.Animation.FadeInAnimation', $AA.FadeAnimation); 1653$AA.registerAnimation('fadeIn', $AA.FadeInAnimation); 1654 1655 1656///<summary> 1657/// The FadeOutAnimation will fade the element out by moving from visible to hidden. It starts the animation 1658/// at the element's current opacity. 1659///</summary> 1660///<member name="cT:AjaxControlToolkit.FadeOutAnimation" base="AjaxControlToolkit.FadeAnimation" /> 1661 1662/// <summary /> 1663/// <member name="cM:AjaxControlToolkit.FadeOutAnimation.ctor" /> 1664/// <param name="target" type="Object">Target of the animation.</param> 1665/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1666/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1667/// <param name="minimumOpacity" type="Number">Minimum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 0.</param> 1668/// <param name="maximumOpacity" type="Number">Maximum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 1.</param> 1669/// <param name="forceLayoutInIE" type="Boolean">whether or not we should force a layout to be created for Internet Explorer by giving it a width and setting its 1670/// background color (the latter is required in case the user has ClearType enabled). The default value is true. 1671/// This is obviously ignored when working in other browsers.</param> 1672$AA.FadeOutAnimation = function(target, duration, fps, minimumOpacity, maximumOpacity, forceLayoutInIE) { 1673 $AA.FadeOutAnimation.initializeBase(this, [target, duration, fps, $AA.FadeEffect.FadeOut, minimumOpacity, maximumOpacity, forceLayoutInIE]); 1674} 1675$AA.FadeOutAnimation.prototype = { 1676 /// <summary> 1677 /// The onStart method is called just before the animation is played each time. 1678 /// </summary> 1679 /// <member name="cM:AjaxControlToolkit.FadeOutAnimation.onStart" /> 1680 onStart: function() { 1681 $AA.FadeOutAnimation.callBaseMethod(this, 'onStart'); 1682 1683 if(this._currentTarget) { 1684 this.set_startValue($common.getElementOpacity(this._currentTarget)); 1685 } 1686 } 1687} 1688$AA.FadeOutAnimation.registerClass('Sys.Extended.UI.Animation.FadeOutAnimation', $AA.FadeAnimation); 1689$AA.registerAnimation('fadeOut', $AA.FadeOutAnimation); 1690 1691///<summary> 1692/// The PulseAnimation fades an element in and our repeatedly to create a pulsating 1693/// effect. The iterations determines how many pulses there will be (which defaults 1694/// to three, but it will repeat infinitely if given zero or less). The duration 1695/// property defines the duration of each fade in or fade out, not the duration of 1696/// the animation as a whole. 1697///</summary> 1698///<member name="cT:AjaxControlToolkit.PulseAnimation" base="AjaxControlToolkit.SequenceAnimation" /> 1699 1700/// <summary /> 1701/// <member name="cM:AjaxControlToolkit.PulseAnimation.ctor" /> 1702/// <param name="target" type="Object">Target of the animation.</param> 1703/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1704/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1705/// <param name="iterations" type="Number">Number of times to repeatedly play the sequence. If zero or less iterations are specified, the sequence 1706/// will repeat forever. The default value is 1 iteration.</param> 1707/// <param name="minimumOpacity" type="Number">Minimum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 0.</param> 1708/// <param name="maximumOpacity" type="Number">Maximum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 1.</param> 1709/// <param name="forceLayoutInIE" type="Boolean">whether or not we should force a layout to be created for Internet Explorer by giving it a width and setting its 1710/// background color (the latter is required in case the user has ClearType enabled). The default value is true. 1711/// This is obviously ignored when working in other browsers.</param> 1712$AA.PulseAnimation = function(target, duration, fps, iterations, minimumOpacity, maximumOpacity, forceLayoutInIE) { 1713 $AA.PulseAnimation.initializeBase(this, [target, duration, fps, null, ((iterations !== undefined) ? iterations : 3)]); 1714 1715 // Create the FadeOutAnimation 1716 this._out = new $AA.FadeOutAnimation(target, duration, fps, minimumOpacity, maximumOpacity, forceLayoutInIE); 1717 this.add(this._out); 1718 1719 // Create the FadeInAnimation 1720 this._in = new $AA.FadeInAnimation(target, duration, fps, minimumOpacity, maximumOpacity, forceLayoutInIE); 1721 this.add(this._in); 1722} 1723$AA.PulseAnimation.prototype = { 1724 ///<summary> 1725 /// Minimum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 0. 1726 ///</summary> 1727 ///<getter>get_minimumOpacity</getter> 1728 ///<setter>set_minimumOpacity</setter> 1729 ///<member name="cP:AjaxControlToolkit.PulseAnimation.minimumOpacity" /> 1730 get_minimumOpacity: function() { 1731 return this._out.get_minimumOpacity(); 1732 }, 1733 set_minimumOpacity: function(value) { 1734 value = this._getFloat(value); 1735 this._out.set_minimumOpacity(value); 1736 this._in.set_minimumOpacity(value); 1737 this.raisePropertyChanged('minimumOpacity'); 1738 }, 1739 1740 ///<summary> 1741 /// Maximum opacity to use when fading in or out. Its value can range from between 0 to 1. The default value is 1. 1742 ///</summary> 1743 ///<getter>get_maximumOpacity</getter> 1744 ///<setter>set_maximumOpacity</setter> 1745 ///<member name="cP:AjaxControlToolkit.PulseAnimation.maximumOpacity" /> 1746 get_maximumOpacity: function() { 1747 return this._out.get_maximumOpacity(); 1748 }, 1749 set_maximumOpacity: function(value) { 1750 value = this._getFloat(value); 1751 this._out.set_maximumOpacity(value); 1752 this._in.set_maximumOpacity(value); 1753 this.raisePropertyChanged('maximumOpacity'); 1754 }, 1755 1756 ///<summary> 1757 /// Whether or not we should force a layout to be created for Internet Explorer by giving it a width and setting its 1758 /// background color (the latter is required in case the user has ClearType enabled). The default value is true. 1759 /// This is obviously ignored when working in other browsers. 1760 ///</summary> 1761 ///<getter>get_forceLayoutInIE</getter> 1762 ///<setter>set_forceLayoutInIE</setter> 1763 ///<member name="cP:AjaxControlToolkit.PulseAnimation.forceLayoutInIE" /> 1764 get_forceLayoutInIE: function() { 1765 return this._out.get_forceLayoutInIE(); 1766 }, 1767 set_forceLayoutInIE: function(value) { 1768 value = this._getBoolean(value); 1769 this._out.set_forceLayoutInIE(value); 1770 this._in.set_forceLayoutInIE(value); 1771 this.raisePropertyChanged('forceLayoutInIE'); 1772 }, 1773 1774 /// <summary> 1775 /// Override the duration property. 1776 /// </summary> 1777 /// <member name="cM:AjaxControlToolkit.PulseAnimation.setDuration" /> 1778 /// <param name="value" type="Number">Length of the animation in seconds.</param> 1779 setDuration: function(value) { 1780 value = this._getFloat(value); 1781 $AA.PulseAnimation.callBaseMethod(this, 'set_duration', [value]); 1782 this._in.set_duration(value); 1783 this._out.set_duration(value); 1784 }, 1785 set_duration: function(value) { 1786 Sys.Extended.Deprecated("setDuration(value)", "set_duration(value)"); 1787 this.setDuration(value); 1788 }, 1789 1790 /// <summary> 1791 /// Override the fps property. 1792 /// </summary> 1793 /// <member name="cM:AjaxControlToolkit.PulseAnimation.setFps" /> 1794 /// <param name="value" type="Number">Number of steps per second..</param> 1795 setFps: function(value) { 1796 value = this._getInteger(value); 1797 $AA.PulseAnimation.callBaseMethod(this, 'set_fps', [value]); 1798 this._in.set_fps(value); 1799 this._out.set_fps(value); 1800 }, 1801 set_fps: function(value) { 1802 Sys.Extended.Deprecated("setFps(value)", "set_fps(value)"); 1803 this.setFps(value); 1804 } 1805 1806} 1807$AA.PulseAnimation.registerClass('Sys.Extended.UI.Animation.PulseAnimation', $AA.SequenceAnimation); 1808$AA.registerAnimation('pulse', $AA.PulseAnimation); 1809 1810///<summary> 1811/// The PropertyAnimation is a useful base animation that will assign the value from 1812/// getAnimatedValue to a specified property. You can provide the name of 1813/// a property alongside an optional propertyKey (which indicates the value 1814/// property[propertyKey], like style['backgroundColor']). 1815///</summary> 1816///<member name="cT:AjaxControlToolkit.PropertyAnimation" base="AjaxControlToolkit.Animation" /> 1817 1818/// <summary /> 1819/// <member name="cM:AjaxControlToolkit.PropertyAnimation.ctor" /> 1820/// <param name="target" type="Object">Length of the animation in seconds. The default is 1.</param> 1821/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1822/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1823/// <param name="property" type="Object">Property of the target element to set when animating.</param> 1824/// <pa
1824ram name="propertyKey" type="Object">optional key of the property to be set (which indicates the value property[propertyKey], 1825/// like style['backgroundColor']). Note that for the style property, the key must be in a JavaScript friendly 1826/// format (i.e. backgroundColor instead of background-color).</param> 1827$AA.PropertyAnimation = function(target, duration, fps, property, propertyKey) { 1828 $AA.PropertyAnimation.initializeBase(this, [target, duration, fps]); 1829 1830 // Name of the property to set 1831 this._property = property; 1832 1833 // Optional Key of the property to set (i.e., if the property were "style" then 1834 // this might be "backgroundColor") 1835 this._propertyKey = propertyKey; 1836 1837 // Current target of the animation that is cached before the animation plays (since looking up 1838 // the target could mean walking all the way up to the root of the animation's tree, which we don't 1839 // want to do for every step of the animation) 1840 this._currentTarget = null; 1841} 1842$AA.PropertyAnimation.prototype = { 1843 /// <summary> 1844 /// The onStart method is called just before the animation is played each time. 1845 /// </summary> 1846 /// <member name="cM:AjaxControlToolkit.PropertyAnimation.onStart" /> 1847 onStart: function() { 1848 $AA.PropertyAnimation.callBaseMethod(this, 'onStart'); 1849 1850 this._currentTarget = this.get_target(); 1851 }, 1852 1853 /// <summary> 1854 /// Set the property's value. 1855 /// </summary> 1856 /// <member name="cM:AjaxControlToolkit.PropertyAnimation.setValue" /> 1857 /// <param name="value" type="Object">Value to set.</param> 1858 setValue: function(value) { 1859 var element = this._currentTarget; 1860 if(element && this._property && this._property.length > 0) { 1861 if(this._propertyKey && this._propertyKey.length > 0 && element[this._property]) { 1862 element[this._property][this._propertyKey] = value; 1863 } else { 1864 element[this._property] = value; 1865 } 1866 } 1867 }, 1868 1869 /// <summary> 1870 /// Get the property's current value. 1871 /// </summary> 1872 /// <member name="cM:AjaxControlToolkit.PropertyAnimation.getValue" /> 1873 getValue: function() { 1874 var element = this.get_target(); 1875 if(element && this._property && this._property.length > 0) { 1876 var property = element[this._property]; 1877 if(property) { 1878 if(this._propertyKey && this._propertyKey.length > 0) { 1879 return property[this._propertyKey]; 1880 } 1881 return property; 1882 } 1883 } 1884 return null; 1885 }, 1886 1887 /// <summary> 1888 /// A string value specifying the name of the target element's property to be set when animation plays. 1889 /// </summary> 1890 /// <getter>get_property</getter> 1891 /// <setter>set_property</setter> 1892 /// <member name="cP:AjaxControlToolkit.PropertyAnimation.property" /> 1893 get_property: function() { 1894 return this._property; 1895 }, 1896 set_property: function(value) { 1897 if(this._property != value) { 1898 this._property = value; 1899 this.raisePropertyChanged('property'); 1900 } 1901 }, 1902 1903 /// <summary> 1904 /// Optional key of the property to be set (which indicates the value property[propertyKey], like style['backgroundColor']). 1905 /// Note that for the style property, the key must be in a JavaScript friendly format (i.e. backgroundColor instead of background-color). 1906 /// </summary> 1907 /// <getter>get_propertyKey</getter> 1908 /// <setter>set_propertyKey</setter> 1909 /// <member name="cP:AjaxControlToolkit.PropertyAnimation.propertyKey" /> 1910 get_propertyKey: function() { 1911 return this._propertyKey; 1912 }, 1913 set_propertyKey: function(value) { 1914 if(this._propertyKey != value) { 1915 this._propertyKey = value; 1916 this.raisePropertyChanged('propertyKey'); 1917 } 1918 } 1919} 1920$AA.PropertyAnimation.registerClass('Sys.Extended.UI.Animation.PropertyAnimation', $AA.Animation); 1921$AA.registerAnimation('property', $AA.PropertyAnimation); 1922 1923///<summary> 1924/// The DiscreteAnimation inherits from Sys.Extended.UI.Animation.PropertyAnimation 1925/// and sets the value of the property to the elements in a provided array of values. 1926///</summary> 1927///<member name="cT:AjaxControlToolkit.DiscreteAnimation" base="AjaxControlToolkit.PropertyAnimation" /> 1928 1929/// <summary /> 1930/// <member name="cM:AjaxControlToolkit.DiscreteAnimation.ctor" /> 1931/// <param name="target" type="Object">Length of the animation in seconds. The default is 1.</param> 1932/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1933/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1934/// <param name="property" type="Object">Property of the target element to set when animating.</param> 1935/// <param name="propertyKey" type="Object">optional key of the property to be set (which indicates the value property[propertyKey], 1936/// like style['backgroundColor']). Note that for the style property, the key must be in a JavaScript friendly 1937/// format (i.e. backgroundColor instead of background-color).</param> 1938/// <param name="values" type="Object">Array of possible values of the property that will be iterated over as the animation is played.</param> 1939$AA.DiscreteAnimation = function(target, duration, fps, property, propertyKey, values) { 1940 $AA.DiscreteAnimation.initializeBase(this, [target, duration, fps, property, propertyKey]); 1941 1942 // Values to assign to the property 1943 this._values = (values && values.length) ? values : []; 1944} 1945$AA.DiscreteAnimation.prototype = { 1946 /// <summary> 1947 /// Assign the value whose index corresponds to the current percentage. 1948 /// </summary> 1949 /// <member name="cM:AjaxControlToolkit.DiscreteAnimation.getAnimatedValue" /> 1950 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 1951 getAnimatedValue: function(percentage) { 1952 var index = Math.floor(this.interpolate(0, this._values.length - 1, percentage)); 1953 return this._values[index]; 1954 }, 1955 1956 /// <summary> 1957 /// Array of possible values of the property that will be iterated over as the animation is played 1958 /// </summary> 1959 /// <getter>get_values</getter> 1960 /// <setter>set_values</setter> 1961 /// <member name="cP:AjaxControlToolkit.DiscreteAnimation.values" /> 1962 get_values: function() { 1963 return this._values; 1964 }, 1965 set_values: function(value) { 1966 if(this._values != value) { 1967 this._values = value; 1968 this.raisePropertyChanged('values'); 1969 } 1970 } 1971} 1972$AA.DiscreteAnimation.registerClass('Sys.Extended.UI.Animation.DiscreteAnimation', $AA.PropertyAnimation); 1973$AA.registerAnimation('discrete', $AA.DiscreteAnimation); 1974 1975///<summary> 1976/// The InterpolatedAnimation assigns a range of values between startValue 1977/// and endValue to the designated property. 1978///</summary> 1979///<member name="cT:AjaxControlToolkit.InterpolatedAnimation" base="AjaxControlToolkit.PropertyAnimation" /> 1980 1981/// <summary /> 1982/// <member name="cM:AjaxControlToolkit.InterpolatedAnimation.ctor" /> 1983/// <param name="target" type="Object">Length of the animation in seconds. The default is 1.</param> 1984/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 1985/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 1986/// <param name="property" type="Object">Property of the target element to set when animating.</param> 1987/// <param name="propertyKey" type="Object">optional key of the property to be set (which indicates the value property[propertyKey], 1988/// like style['backgroundColor']). Note that for the style property, the key must be in a JavaScript friendly 1989/// format (i.e. backgroundColor instead of background-color).</param> 1990/// <param name="startValue" type="Object">Start of the range of values.</param> 1991/// <param name="endValue" type="Object">End of the range of values.</param> 1992$AA.InterpolatedAnimation = function(target, duration, fps, property, propertyKey, startValue, endValue) { 1993 $AA.InterpolatedAnimation.initializeBase(this, [target, duration, fps, ((property !== undefined) ? property : 'style'), propertyKey]); 1994 1995 // Start and end values 1996 this._startValue = startValue; 1997 this._endValue = endValue; 1998} 1999$AA.InterpolatedAnimation.prototype = { 2000 /// <summary> 2001 /// Specifies the start value of the value range. 2002 /// </summary> 2003 /// <getter>get_startValue</getter> 2004 /// <setter>set_startValue</setter> 2005 /// <member name="cP:AjaxControlToolkit.InterpolatedAnimation.startValue" /> 2006 get_startValue: function() { 2007 return this._startValue; 2008 }, 2009 set_startValue: function(value) { 2010 value = this._getFloat(value); 2011 if(this._startValue != value) { 2012 this._startValue = value; 2013 this.raisePropertyChanged('startValue'); 2014 } 2015 }, 2016 2017 /// <summary> 2018 /// Specifies the end value of the value range. 2019 /// </summary> 2020 /// <getter>get_endValue</getter> 2021 /// <setter>set_endValue</setter> 2022 /// <member name="cP:AjaxControlToolkit.InterpolatedAnimation.endValue" /> 2023 get_endValue: function() { 2024 return this._endValue; 2025 }, 2026 set_endValue: function(value) { 2027 value = this._getFloat(value); 2028 if(this._endValue != value) { 2029 this._endValue = value; 2030 this.raisePropertyChanged('endValue'); 2031 } 2032 } 2033} 2034$AA.InterpolatedAnimation.registerClass('Sys.Extended.UI.Animation.InterpolatedAnimation', $AA.PropertyAnimation); 2035$AA.registerAnimation('interpolated', $AA.InterpolatedAnimation); 2036 2037///<summary> 2038/// The ColorAnimation transitions the value of the property between 2039/// two colors (although it does ignore the alpha channel). The colors must be 7-character hex strings 2040/// (like #246ACF). 2041///</summary> 2042///<member name="cT:AjaxControlToolkit.ColorAnimation" base="AjaxControlToolkit.InterpolatedAnimation" /> 2043 2044/// <summary /> 2045/// <member name="cM:AjaxControlToolkit.ColorAnimation.ctor" /> 2046/// <param name="target" type="Object">Length of the animation in seconds. The default is 1.</param> 2047/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2048/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2049/// <param name="property" type="Object">Property of the target element to set when animating.</param> 2050/// <param name="propertyKey" type="Object">optional key of the property to be set (which indicates the value property[propertyKey], 2051/// like style['backgroundColor']). Note that for the style property, the key must be in a JavaScript friendly 2052/// format (i.e. backgroundColor instead of background-color).</param> 2053/// <param name="startValue" type="Object">Start of the range of values.</param> 2054/// <param name="endValue" type="Object">End of the range of values.</param> 2055$AA.ColorAnimation = function(target, duration, fps, property, propertyKey, startValue, endValue) { 2056 $AA.ColorAnimation.initializeBase(this, [target, duration, fps, property, propertyKey, startValue, endValue]); 2057 2058 // Cached start/end RBG triplets 2059 this._start = null; 2060 this._end = null; 2061 2062 // Flags indicating whether each dimension of color will be interpolated 2063 this._interpolateRed = false;
2064 this._interpolateGreen = false; 2065 this._interpolateBlue = false; 2066} 2067$AA.ColorAnimation.prototype = { 2068 /// <summary> 2069 /// Determine which dimensions of color will be animated. 2070 /// </summary> 2071 /// <member name="cM:AjaxControlToolkit.ColorAnimation.onStart" /> 2072 onStart: function() { 2073 $AA.ColorAnimation.callBaseMethod(this, 'onStart'); 2074 2075 this._start = $AA.ColorAnimation.getRGB(this.get_startValue()); 2076 this._end = $AA.ColorAnimation.getRGB(this.get_endValue()); 2077 2078 this._interpolateRed = (this._start.Red != this._end.Red); 2079 this._interpolateGreen = (this._start.Green != this._end.Green); 2080 this._interpolateBlue = (this._start.Blue != this._end.Blue); 2081 }, 2082 2083 /// <summary> 2084 /// Get the interpolated color values. 2085 /// </summary> 2086 /// <member name="cM:AjaxControlToolkit.ColorAnimation.getAnimatedValue" /> 2087 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 2088 getAnimatedValue: function(percentage) { 2089 var r = this._start.Red; 2090 var g = this._start.Green; 2091 var b = this._start.Blue; 2092 2093 if(this._interpolateRed) 2094 r = Math.round(this.interpolate(r, this._end.Red, percentage)); 2095 2096 if(this._interpolateGreen) 2097 g = Math.round(this.interpolate(g, this._end.Green, percentage)); 2098 2099 if(this._interpolateBlue) 2100 b = Math.round(this.interpolate(b, this._end.Blue, percentage)); 2101 2102 return $AA.ColorAnimation.toColor(r, g, b); 2103 }, 2104 2105 /// <summary> 2106 /// Starting color of the transition formatted as a 7-character hex string (like #246ACF). 2107 /// </summary> 2108 /// <setter>set_startValue</setter> 2109 /// <member name="cP:AjaxControlToolkit.ColorAnimation.startValue" /> 2110 set_startValue: function(value) { 2111 if(this._startValue != value) { 2112 this._startValue = value; 2113 this.raisePropertyChanged('startValue'); 2114 } 2115 }, 2116 2117 /// <summary> 2118 /// Ending color of the transition formatted as a 7-character hex string (like #246ACF). 2119 /// </summary> 2120 /// <setter>set_startValue</setter> 2121 /// <member name="cP:AjaxControlToolkit.ColorAnimation.endValue" /> 2122 set_endValue: function(value) { 2123 if(this._endValue != value) { 2124 this._endValue = value; 2125 this.raisePropertyChanged('endValue'); 2126 } 2127 } 2128} 2129 2130/// <summary> 2131/// Convert the color to an RGB triplet. 2132/// </summary> 2133/// <member name="cM:AjaxControlToolkit.ColorAnimation.getRGB" static="true" /> 2134/// <param name="color" type="String">Color formatted as a 7-character hex string (like #246ACF).</param> 2135$AA.ColorAnimation.getRGB = function(color) { 2136 if(!color || color.length != 7) { 2137 throw String.format(Sys.Extended.UI.Resources.Animation_InvalidColor, color); 2138 } 2139 return { 2140 'Red': parseInt(color.substr(1, 2), 16), 2141 'Green': parseInt(color.substr(3, 2), 16), 2142 'Blue': parseInt(color.substr(5, 2), 16) 2143 }; 2144} 2145 2146/// <summary> 2147/// Convert an RBG triplet into a 7-character hex string (like #246ACF). 2148/// </summary> 2149/// <member name="cM:AjaxControlToolkit.ColorAnimation.toColor" static="true" /> 2150/// <param name="red" type="Object">Value of the color's red dimension.</param> 2151/// <param name="green" type="Object">Value of the color's green dimension.</param> 2152/// <param name="blue" type="Object">Value of the color's blue dimension.</param> 2153$AA.ColorAnimation.toColor = function(red, green, blue) { 2154 var r = red.toString(16); 2155 var g = green.toString(16); 2156 var b = blue.toString(16); 2157 if(r.length == 1) r = '0' + r; 2158 if(g.length == 1) g = '0' + g; 2159 if(b.length == 1) b = '0' + b; 2160 return '#' + r + g + b; 2161} 2162$AA.ColorAnimation.registerClass('Sys.Extended.UI.Animation.ColorAnimation', $AA.InterpolatedAnimation); 2163$AA.registerAnimation('color', $AA.ColorAnimation); 2164 2165///<summary> 2166/// The LengthAnimation is identical to Sys.Extended.UI.Animation.InterpolatedAnimation 2167/// except it adds a unit to the value before assigning it to the property. 2168///</summary> 2169///<member name="cT:AjaxControlToolkit.LengthAnimation" base="AjaxControlToolkit.InterpolatedAnimation" /> 2170 2171/// <summary /> 2172/// <member name="cM:AjaxControlToolkit.LengthAnimation.ctor" /> 2173/// <param name="target" type="Object">Length of the animation in seconds. The default is 1.</param> 2174/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2175/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2176/// <param name="property" type="Object">Property of the target element to set when animating.</param> 2177/// <param name="propertyKey" type="Object">optional key of the property to be set (which indicates the value property[propertyKey], 2178/// like style['backgroundColor']). Note that for the style property, the key must be in a JavaScript friendly 2179/// format (i.e. backgroundColor instead of background-color).</param> 2180/// <param name="startValue" type="Object">Start of the range of values.</param> 2181/// <param name="endValue" type="Object">End of the range of values.</param> 2182/// <param name="unit" type="String">Unit of the interpolated values. The default value is 'px'.</param> 2183$AA.LengthAnimation = function(target, duration, fps, property, propertyKey, startValue, endValue, unit) { 2184 $AA.LengthAnimation.initializeBase(this, [target, duration, fps, property, propertyKey, startValue, endValue]); 2185 2186 // Unit of length (which defaults to px) 2187 this._unit = (unit != null) ? unit : 'px'; 2188} 2189$AA.LengthAnimation.prototype = { 2190 /// <summary> 2191 /// Get the interpolated length value. 2192 /// </summary> 2193 /// <member name="cM:AjaxControlToolkit.LengthAnimation.getAnimatedValue" /> 2194 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 2195 getAnimatedValue: function(percentage) { 2196 var value = this.interpolate(this.get_startValue(), this.get_endValue(), percentage); 2197 return Math.round(value) + this._unit; 2198 }, 2199 2200 /// <summary> 2201 /// Unit of the interpolated values. The default value is 'px'. 2202 /// </summary> 2203 /// <getter>get_unit</getter> 2204 /// <setter>set_unit</setter> 2205 /// <member name="cP:AjaxControlToolkit.LengthAnimation.unit" /> 2206 get_unit: function() { 2207 return this._unit; 2208 }, 2209 set_unit: function(value) { 2210 if(this._unit != value) { 2211 this._unit = value; 2212 this.raisePropertyChanged('unit'); 2213 } 2214 } 2215} 2216$AA.LengthAnimation.registerClass('Sys.Extended.UI.Animation.LengthA
2216nimation', $AA.InterpolatedAnimation); 2217$AA.registerAnimation('length', $AA.LengthAnimation); 2218 2219///<summary> 2220/// The MoveAnimation is used to move the target element. If the 2221/// relative flag is set to true, then it treats the horizontal 2222/// and vertical properties as offsets to move the element. If the relative 2223/// flag is false, then it will treat the horizontal and vertical 2224/// properties as coordinates on the page where the target element should be moved. It is 2225/// important to note that the target must be positioned (i.e. absolutely) so 2226/// that settings its top/left style attributes will change its location. 2227///</summary> 2228///<member name="cT:AjaxControlToolkit.MoveAnimation" base="AjaxControlToolkit.ParallelAnimation" /> 2229 2230/// <summary /> 2231/// <member name="cM:AjaxControlToolkit.MoveAnimation.ctor" /> 2232/// <param name="target" type="Object">Length of the animation in seconds. The default is 1.</param> 2233/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2234/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2235/// <param name="horizontal" type="Number">If relative is true, this is the offset to move horizontally. Otherwise this is the x 2236/// coordinate on the page where the target should be moved.</param> 2237/// <param name="vertical" type="Number">if relative is true, this is the offset to move vertically. Otherwise this is the y 2238/// coordinate on the page where the target should be moved.</param> 2239/// <param name="relative" type="Boolean">true if we are moving relative to the current position, false if we are moving absolutely.</param> 2240/// <param name="unit" type="String">Unit of the interpolated values. The default value is 'px'.</param> 2241$AA.MoveAnimation = function(target, duration, fps, horizontal, vertical, relative, unit) { 2242 $AA.MoveAnimation.initializeBase(this, [target, duration, fps, null]); 2243 2244 // Distance to move horizontally and vertically 2245 this._horizontal = horizontal ? horizontal : 0; 2246 this._vertical = vertical ? vertical : 0; 2247 this._relative = (relative === undefined) ? true : relative; 2248 2249 // Length animations representing the movememnts 2250 this._horizontalAnimation = new $AA.LengthAnimation(target, duration, fps, 'style', 'left', null, null, unit); 2251 this._verticalAnimation = new $AA.LengthAnimation(target, duration, fps, 'style', 'top', null, null, unit); 2252 this.add(this._verticalAnimation); 2253 this.add(this._horizontalAnimation); 2254} 2255$AA.MoveAnimation.prototype = { 2256 /// <summary> 2257 /// The onStart method is called just before the animation is played each time. 2258 /// </summary> 2259 /// <member name="cM:AjaxControlToolkit.MoveAnimation.onStart" /> 2260 onStart: function() { 2261 // Use the target's current position as the starting point for the animation 2262 $AA.MoveAnimation.callBaseMethod(this, 'onStart'); 2263 2264 // Set the start and end values of the animations by getting 2265 // the element's current position and applying the offsets 2266 var element = this.get_target(); 2267 this._horizontalAnimation.set_startValue(element.offsetLeft); 2268 this._horizontalAnimation.set_endValue(this._relative ? element.offsetLeft + this._horizontal : this._horizontal); 2269 this._verticalAnimation.set_startValue(element.offsetTop); 2270 this._verticalAnimation.set_endValue(this._relative ? element.offsetTop + this._vertical : this._vertical); 2271 }, 2272 2273 get_horizontal: function() { 2274 // If relative is true, this is the offset to move horizontally. Otherwise this is the x 2275 // coordinate on the page where the target should be moved. 2276 return this._horizontal; 2277 }, 2278 set_horizontal: function(value) { 2279 value = this._getFloat(value); 2280 if(this._horizontal != value) { 2281 this._horizontal = value; 2282 this.raisePropertyChanged('horizontal'); 2283 } 2284 }, 2285 2286 get_vertical: function() { 2287 // If relative is true, this is the offset to move vertically. Otherwise this is the y 2288 // coordinate on the page where the target should be moved. 2289 return this._vertical; 2290 }, 2291 set_vertical: function(value) { 2292 value = this._getFloat(value); 2293 if(this._vertical != value) { 2294 this._vertical = value; 2295 this.raisePropertyChanged('vertical'); 2296 } 2297 }, 2298 2299 get_relative: function() { 2300 // true if we are moving relative to the current position, false if we are moving absolutely 2301 return this._relative; 2302 }, 2303 set_relative: function(value) { 2304 value = this._getBoolean(value); 2305 if(this._relative != value) { 2306 this._relative = value; 2307 this.raisePropertyChanged('relative'); 2308 } 2309 }, 2310 2311 get_unit: function() { 2312 // Length unit for the size of the target. The default value is 'px'. 2313 this._horizontalAnimation.get_unit(); 2314 }, 2315 set_unit: function(value) { 2316 var unit = this._horizontalAnimation.get_unit(); 2317 if(unit != value) { 2318 this._horizontalAnimation.set_unit(value); 2319 this._verticalAnimation.set_unit(value); 2320 this.raisePropertyChanged('unit'); 2321 } 2322 } 2323} 2324$AA.MoveAnimation.registerClass('Sys.Extended.UI.Animation.MoveAnimation', $AA.ParallelAnimation); 2325$AA.registerAnimation('move', $AA.MoveAnimation); 2326 2327///<summary> 2328/// The ResizeAnimation changes the size of the target from its 2329/// current value to the specified width and height. 2330///</summary> 2331///<member name="cT:AjaxControlToolkit.ResizeAnimation" base="AjaxControlToolkit.ParallelAnimation" /> 2332 2333/// <summary /> 2334/// <member name="cM:AjaxControlToolkit.ResizeAnimation.ctor" /> 2335/// <param name="target" type="Object">Target of the animation.</param> 2336/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2337/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2338/// <param name="width" type="Number">New width of the target.</param> 2339/// <param name="height" type="Number">New height of the target.</param> 2340/// <param name="unit" type="String">Length unit for the size of the target. The default value is 'px'.</param> 2341$AA.ResizeAnimation = function(target, duration, fps, width, height, unit) { 2342 $AA.ResizeAnimation.initializeBase(this, [target, duration, fps, null]); 2343 2344 // New size of the element 2345 this._width = width; 2346 this._height = height; 2347 2348 // Animations to set the size across both dimensions 2349 this._horizontalAnimation = new $AA.LengthAnimation(target, duration, fps, 'style', 'width', null, null, unit); 2350 this._verticalAnimation = new $AA.LengthAnimation(target, duration, fps, 'style', 'he
2350ight', null, null, unit); 2351 this.add(this._horizontalAnimation); 2352 this.add(this._verticalAnimation); 2353} 2354$AA.ResizeAnimation.prototype = { 2355 /// <summary> 2356 /// The onStart method is called just before the animation is played each time. 2357 /// </summary> 2358 /// <member name="cM:AjaxControlToolkit.ResizeAnimation.onStart" /> 2359 onStart: function() { 2360 // Use the target's current size as the starting point for the animation 2361 $AA.ResizeAnimation.callBaseMethod(this, 'onStart'); 2362 2363 // Set the start and end values of the animations by getting 2364 // the element's current width and height 2365 var element = this.get_target(); 2366 this._horizontalAnimation.set_startValue(element.offsetWidth); 2367 this._verticalAnimation.set_startValue(element.offsetHeight); 2368 this._horizontalAnimation.set_endValue((this._width !== null && this._width !== undefined) ? 2369 this._width : element.offsetWidth); 2370 this._verticalAnimation.set_endValue((this._height !== null && this._height !== undefined) ? 2371 this._height : element.offsetHeight); 2372 }, 2373 2374 ///<summary> 2375 /// New width of the element. 2376 ///</summary> 2377 ///<getter>get_width</getter> 2378 ///<setter>set_width</setter> 2379 ///<member name="cP:AjaxControlToolkit.ResizeAnimation.width" /> 2380 get_width: function() { 2381 return this._width; 2382 }, 2383 set_width: function(value) { 2384 value = this._getFloat(value); 2385 if(this._width != value) { 2386 this._width = value; 2387 this.raisePropertyChanged('width'); 2388 } 2389 }, 2390 2391 ///<summary> 2392 /// New height of the element. 2393 ///</summary> 2394 ///<getter>get_height</getter> 2395 ///<setter>set_height</setter> 2396 ///<member name="cP:AjaxControlToolkit.ResizeAnimation.height" /> 2397 get_height: function() { 2398 return this._height; 2399 }, 2400 set_height: function(value) { 2401 value = this._getFloat(value); 2402 if(this._height != value) { 2403 this._height = value; 2404 this.raisePropertyChanged('height'); 2405 } 2406 }, 2407 2408 ///<summary> 2409 /// Length unit for the size of the target. The default value is 'px'. 2410 ///</summary> 2411 ///<getter>get_unit</getter> 2412 ///<setter>set_unit</setter> 2413 ///<member name="cP:AjaxControlToolkit.ResizeAnimation.unit" /> 2414 get_unit: function() { 2415 this._horizontalAnimation.get_unit(); 2416 }, 2417 set_unit: function(value) { 2418 var unit = this._horizontalAnimation.get_unit(); 2419 if(unit != value) { 2420 this._horizontalAnimation.set_unit(value); 2421 this._verticalAnimation.set_unit(value); 2422 this.raisePropertyChanged('unit'); 2423 } 2424 } 2425} 2426$AA.ResizeAnimation.registerClass('Sys.Extended.UI.Animation.ResizeAnimation', $AA.ParallelAnimation); 2427$AA.registerAnimation('resize', $AA.ResizeAnimation); 2428 2429///<summary> 2430/// The ScaleAnimation scales the size of the target element by the given scaleFactor 2431/// (i.e. a scaleFactor of .5 will shrink it in half and a scaleFactor of 2.0 2432/// will double it). If scaleFont is true, the size of the font will also scale with the element. If 2433/// center is true, then the element's center will not move as it is scaled. It is important to note that 2434/// the target must be positioned (i.e. absolutely) so that setting its top/left properties will change 2435/// its location in order for center to have an effect. 2436///</summary> 2437///<member name="cT:AjaxControlToolkit.ScaleAnimation" base="AjaxControlToolkit.Animation" /> 2438 2439/// <summary /> 2440/// <member name="cM:AjaxControlToolkit.ScaleAnimation.ctor" /> 2441/// <param name="target" type="Object">Target of the animation.</param> 2442/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2443/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2444/// <param name="scaleFactor" type="Number">The amount to scale the target (a scaleFactor of .5 will 2445/// shrink it in half and a scaleFactor of 2.0 will double it). The default value is 2446/// 1, which does no scaling.</param> 2447/// <param name="unit" type="String">Length unit for the size of the target. The default value is 'px'.</param> 2448/// <param name="center" type="Boolean">Whether the target should stay centered while scaling.</param>
2449/// <param name="scaleFont" type="Boolean">Whether the font should be scaled along with the size.</param> 2450/// <param name="fontUnit" type="String">Unit of the font, which is only used if scaleFont is true. 2451/// The default value is 'pt'.</param> 2452$AA.ScaleAnimation = function(target, duration, fps, scaleFactor, unit, center, scaleFont, fontUnit) { 2453 $AA.ScaleAnimation.initializeBase(this, [target, duration, fps]); 2454 2455 // Percentage to scale 2456 this._scaleFactor = (scaleFactor !== undefined) ? scaleFactor : 1; 2457 this._unit = (unit !== undefined) ? unit : 'px'; 2458 2459 // Center the content while scaling 2460 this._center = center; 2461 2462 // Scale the font size as well 2463 this._scaleFont = scaleFont; 2464 this._fontUnit = (fontUnit !== undefined) ? fontUnit : 'pt'; 2465 2466 // Initial values 2467 this._element = null; 2468 this._initialHeight = null; 2469 this._initialWidth = null; 2470 this._initialTop = null; 2471 this._initialLeft = null; 2472 this._initialFontSize = null; 2473} 2474$AA.ScaleAnimation.prototype = { 2475 /// <summary> 2476 /// Get the amount to scale the target. 2477 /// </summary> 2478 /// <member name="cM:AjaxControlToolkit.ScaleAnimation.getAnimatedValue" /> 2479 /// <param name="percentage" type="Number">Percentage of the animation already complete.</param> 2480 getAnimatedValue: function(percentage) { 2481 return this.interpolate(1.0, this._scaleFactor, percentage); 2482 }, 2483 2484 /// <summary> 2485 /// The onStart method is called just before the animation is played each time. 2486 /// </summary> 2487 /// <member name="cM:AjaxControlToolkit.ScaleAnimation.onStart" /> 2488 onStart: function() { 2489 // Cache the initial size because it will be used to determine how much to scale the element at each step of the animation 2490 $AA.ScaleAnimation.callBaseMethod(this, 'onStart'); 2491 2492 this._element = this.get_target(); 2493 if(this._element) { 2494 this._initialHeight = this._element.offsetHeight; 2495 this._initialWidth = this._element.offsetWidth; 2496 if(this._center) { 2497 this._initialTop = this._element.offsetTop; 2498 this._initialLeft = this._element.offsetLeft; 2499 } 2500 if(this._scaleFont) { 2501 // Note: we're assuming this is in the same units as fontUnit 2502 this._initialFontSize = parseFloat( 2503 $common.getCurrentStyle(this._element, 'fontSize')); 2504 } 2505 } 2506 }, 2507 2508 /// <summary> 2509 /// Scale the target by the given percentage. 2510 /// </summary> 2511 /// <member name="cM:AjaxControlToolkit.ScaleAnimation.setValue" /> 2512 /// <param name="scale" type="Number">Percentage to scale the target.</param> 2513 setValue: function(scale) { 2514 if(this._element) { 2515 var width = Math.round(this._initialWidth * scale); 2516 var height = Math.round(this._initialHeight * scale); 2517 this._element.style.width = width + this._unit; 2518 this._element.style.height = height + this._unit; 2519 2520 if(this._center) { 2521 this._element.style.top = (this._initialTop + 2522 Math.round((this._initialHeight - height) / 2)) + this._unit; 2523 this._element.style.left = (this._initialLeft + 2524 Math.round((this._initialWidth - width) / 2)) + this._unit; 2525 } 2526 2527 if(this._scaleFont) { 2528 var size = this._initialFontSize * scale; 2529 if(this._fontUnit == 'px' || this._fontUnit == 'pt') { 2530 size = Math.round(size); 2531 } 2532 this._element.style.fontSize = size + this._fontUnit; 2533 } 2534 } 2535 }, 2536 2537 /// <summary> 2538 /// The onEnd method is called just after the animation is played each time. 2539 /// </summary> 2540 /// <member name="cM:AjaxControlToolkit.ScaleAnimation.onEnd" /> 2541 onEnd: function() { 2542 // Wipe the cached values after the animation completes 2543 this._element = null; 2544 this._initialHeight = null; 2545 this._initialWidth = null; 2546 this._initialTop = null; 2547 this._initialLeft = null; 2548 this._initialFontSize = null; 2549 $AA.ScaleAnimation.callBaseMethod(this, 'onEnd'); 2550 }, 2551 2552 ///<summary> 2553 /// The amount to scale the target (a scaleFactor of .5 will 2554 /// shrink it in half and a scaleFactor of 2.0 will double it). The default value is 2555 /// 1, which does no scaling. 2556 ///</summary> 2557 ///<getter>get_scaleFactore</getter> 2558 ///<setter>set_scaleFactore</setter> 2559 ///<member name="cP:AjaxControlToolkit.ScaleAnimation.scaleFactor" /> 2560 get_scaleFactor: function() { 2561 return this._scaleFactor; 2562 }, 2563 set_scaleFactor: function(value) { 2564 value = this._getFloat(value); 2565 if(this._scaleFactor != value) { 2566 this._scaleFactor = value; 2567 this.raisePropertyChanged('scaleFactor'); 2568 } 2569 }, 2570 2571 ///<summary> 2572 /// Length unit for the size of the target. The default value is 'px'. 2573 ///</summary> 2574 ///<getter>get_unit</getter> 2575 ///<setter>set_unit</setter> 2576 ///<member name="cP:AjaxControlToolkit.ScaleAnimation.unit" /> 2577 get_unit: function() { 2578 return this._unit; 2579 }, 2580 set_unit: function(value) { 2581 if(this._unit != value) { 2582 this._unit = value; 2583 this.raisePropertyChanged('unit'); 2584 } 2585 }, 2586 2587 ///<summary> 2588 /// Whether the target should stay centered while scaling. 2589 ///</summary> 2590 ///<getter>get_center</getter> 2591 ///<setter>set_center</setter> 2592 ///<member name="cP:AjaxControlToolkit.ScaleAnimation.center" /> 2593 get_center: function() { 2594 return this._center; 2595 }, 2596 set_center: function(value) { 2597 value = this._getBoolean(value); 2598 if(this._center != value) { 2599 this._center = value; 2600 this.raisePropertyChanged('center'); 2601 } 2602 }, 2603 2604 ///<summary> 2605 /// Whether the font should be scaled along with the size. 2606 ///</summary> 2607 ///<getter>get_scaleFont</getter> 2608 ///<setter>set_scaleFont</setter> 2609 ///<member name="cP:AjaxControlToolkit.ScaleAnimation.scaleFont" /> 2610 get_scaleFont: function() { 2611 return this._scaleFont; 2612 }, 2613 set_scaleFont: function(value) { 2614 value = this._getBoolean(value); 2615 if(this._scaleFont != value) { 2616 this._scaleFont = value; 2617 this.raisePropertyChanged('scaleFont'); 2618 } 2619 }, 2620 2621 ///<summary> 2622 /// Unit of the font, which is only used if scaleFont is true. 2623 /// The default value is 'pt'. 2624 ///</summary> 2625 ///<getter>get_fontUnit</getter> 2626 ///<setter>set_fontUnit</setter> 2627 ///<member name="cP:AjaxControlToolkit.ScaleAnimation.fontUnit" /> 2628 get_fontUnit: function() { 2629 return this._fontUnit; 2630 }, 2631 set_fontUnit: function(value) { 2632 if(this._fontUnit != value) { 2633 this._fontUnit = value; 2634 this.raisePropertyChanged('fontUnit'); 2635 } 2636 } 2637} 2638$AA.ScaleAnimation.registerClass('Sys.Extended.UI.Animation.ScaleAnimation', $AA.Animation); 2639$AA.registerAnimation('scale', $AA.ScaleAnimation); 2640 2641///<summary> 2642/// Action is a base class for all "non-animating" animations that provides empty implementations 2643/// for abstract methods and adds a doAction method that will be called to perform the action's 2644/// operation. While regular animations perform an operation in a sequence of small steps spread over an interval, 2645/// the actions perform a single operation instantaneously. By default, all actions have a duration 2646/// of zero. The actions are very useful for defining complex animations. 2647///</summary> 2648///<member name="cT:AjaxControlToolkit.Action" base="AjaxControlToolkit.Animation" /> 2649 2650/// <summary /> 2651/// <member name="cM:AjaxControlToolkit.Action.ctor" /> 2652/// <param name="target" type="Object">Target of the animation.</param> 2653/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2654/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2655$AA.Action = function(target, duration, fps) { 2656 $AA.Action.initializeBase(this, [target, duration, fps]); 2657 2658 // Set the duration to 0 if it wasn't specified 2659 if(duration === undefined) { 2660 this.set_duration(0); 2661 } 2662} 2663$AA.Action.prototype = { 2664 /// <summary> 2665 /// Calls the doAction method when the animation completes. 2666 /// </summary> 2667 /// <member name="cM:AjaxControlToolkit.Action.onEnd" /> 2668 onEnd: function() { 2669 this.doAction(); 2670 $AA.Action.callBaseMethod(this, 'onEnd'); 2671 }, 2672 2673 /// <summary> 2674 /// The doAction method must be implemented by all actions. 2675 /// </summary> 2676 /// <member name="cM:AjaxControlToolkit.Action.doAction" /> 2677 doAction: function() { 2678 throw Error.notImplemented(); 2679 }, 2680 2681 /// <summary> 2682 /// Empty implementation of required abstract method. 2683 /// </summary> 2684 /// <member name="cM:AjaxControlToolkit.Action.getAnimatedValue" /> 2685 getAnimatedValue: function() { 2686 }, 2687 2688 /// <summary> 2689 /// Empty implementation of required abstract method. 2690 /// </summary> 2691 /// <member name="cM:AjaxControlToolkit.Action.setValue" /> 2692 setValue: function() { 2693 } 2694} 2695$AA.Action.registerClass('Sys.Extended.UI.Animation.Action', $AA.Animation); 2696$AA.registerAnimation('action', $AA.Action); 2697 2698///<summary> 2699/// The EnableAction changes whether or not the target is disabled.
2700///</summary> 2701///<member name="cT:AjaxControlToolkit.EnableAction" base="AjaxControlToolkit.Action" /> 2702 2703/// <summary /> 2704/// <member name="cM:AjaxControlToolkit.EnableAction.ctor" /> 2705/// <param name="target" type="Object">Target of the animation.</param> 2706/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2707/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2708/// <param name="enabled" type="Boolean">Whether or not the target is disabled. The default value is true.</param> 2709$AA.EnableAction = function(target, duration, fps, enabled) { 2710 $AA.EnableAction.initializeBase(this, [target, duration, fps]); 2711 2712 // Whether to enable or disable 2713 this._enabled = (enabled !== undefined) ? enabled : true; 2714} 2715$AA.EnableAction.prototype = { 2716 /// <summary> 2717 /// Sets the enabled property of the target. 2718 /// </summary> 2719 /// <member name="cM:AjaxControlToolkit.EnableAction.doAction" /> 2720 doAction: function() { 2721 var element = this.get_target(); 2722 if(element) { 2723 element.disabled = !this._enabled; 2724 } 2725 }, 2726 2727 ///<summary> 2728 /// Whether or not the target is disabled. The default value is true. 2729 ///</summary> 2730 ///<getter>get_enabled</getter> 2731 ///<setter>set_enabled</setter> 2732 ///<member name="cP:AjaxControlToolkit.EnableAction.enabled" /> 2733 get_enabled: function() { 2734 return this._enabled; 2735 }, 2736 set_enabled: function(value) { 2737 value = this._getBoolean(value); 2738 if(this._enabled != value) { 2739 this._enabled = value; 2740 this.raisePropertyChanged('enabled'); 2741 } 2742 } 2743} 2744$AA.EnableAction.registerClass('Sys.Extended.UI.Animation.EnableAction', $AA.Action); 2745$AA.registerAnimation('enableAction', $AA.EnableAction); 2746 2747///<summary> 2748/// The HideAction simply hides the target from view 2749/// (by setting its style's display attribute to 'none') 2750///</summary> 2751///<member name="cT:AjaxControlToolkit.HideAction" base="AjaxControlToolkit.Action" /> 2752 2753/// <summary /> 2754/// <member name="cM:AjaxControlToolkit.HideAction.ctor" /> 2755/// <param name="target" type="Object">Target of the animation.</param> 2756/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2757/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2758/// <param name="visible" type="Boolean">true to show the target, false to hide it. The default value is false.</param> 2759$AA.HideAction = function(target, duration, fps, visible) { 2760 $AA.HideAction.initializeBase(this, [target, duration, fps]); 2761 2762 this._visible = visible; 2763} 2764$AA.HideAction.prototype = { 2765 /// <summary> 2766 /// Hides the target element. 2767 /// </summary> 2768 /// <member name="cM:AjaxControlToolkit.HideAction.doAction" /> 2769 doAction: function() { 2770 var element = this.get_target(); 2771 if(element) { 2772 $common.setVisible(element, this._visible); 2773 } 2774 }, 2775 2776 ///<summary> 2777 /// True to show the target, false to hide it. The default value is false. 2778 ///</summary> 2779 ///<getter>get_visible</getter> 2780 ///<setter>set_visible</setter> 2781 ///<member name="cP:AjaxControlToolkit.HideAction.visible" /> 2782 get_visible: function() { 2783 return this._visible; 2784 }, 2785 set_visible: function(value) { 2786 if(this._visible != value) { 2787 this._visible = value; 2788 this.raisePropertyChanged('visible'); 2789 } 2790 } 2791} 2792$AA.HideAction.registerClass('Sys.Extended.UI.Animation.HideAction', $AA.Action); 2793$AA.registerAnimation('hideAction', $AA.HideAction); 2794 2795///<summary> 2796/// The StyleAction is used to set a particular attribute of the target's style. 2797///</summary> 2798///<member name="cT:AjaxControlToolkit.StyleAction" base="AjaxControlToolkit.Action" /> 2799 2800/// <summary /> 2801/// <member name="cM:AjaxControlToolkit.StyleAction.ctor" /> 2802/// <param name="target" type="Object">Target of the animation.</param> 2803/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2804/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2805/// <param name="attribute" type="String">Style attribute to set (this must be in a JavaScript friendly format, i.e. backgroundColor 2806/// instead of background-color).</param> 2807/// <param name="value" type="Object">Value to set the attribute.</param> 2808$AA.StyleAction = function(target, duration, fps, attribute, value) { 2809 $AA.StyleAction.initializeBase(this, [target, duration, fps]); 2810 2811 // Style attribute (like "backgroundColor" or "borderWidth" 2812 this._attribute = attribute; 2813 2814 // Value to assign to the style attribute 2815 this._value = value; 2816 2817} 2818$AA.StyleAction.prototype = { 2819 /// <summary> 2820 /// Assigns the value to the style's attribute. 2821 /// </summary> 2822 /// <member name="cM:AjaxControlToolkit.StyleAction.doAction" /> 2823 doAction: function() { 2824 var element = this.get_target(); 2825 if(element) { 2826 element.style[this._attribute] = this._value; 2827 } 2828 }, 2829 2830 ///<summary> 2831 /// Style attribute to set (this must be in a JavaScript friendly format, i.e. backgroundColor 2832 /// instead of background-color). 2833 ///</summary> 2834 ///<getter>get_attribute</getter> 2835 ///<setter>set_attribute</setter> 2836 ///<member name="cP:AjaxControlToolkit.StyleAction.attribute" /> 2837 get_attribute: function() { 2838 return this._attribute; 2839 }, 2840 set_attribute: function(value) { 2841 if(this._attribute != value) { 2842 this._attribute = value; 2843 this.raisePropertyChanged('attribute'); 2844 } 2845 }, 2846 2847 ///<summary> 2848 /// The attribute's value. 2849 ///</summary> 2850 ///<getter>get_value</getter> 2851 ///<setter>set_value</setter> 2852 ///<member name="cP:AjaxControlToolkit.StyleAction.value" /> 2853 get_value: function() { 2854 return this._value; 2855 }, 2856 set_value: function(value) { 2857 if(this._value != value) { 2858 this._value = value; 2859 this.raisePropertyChanged('value'); 2860 } 2861 } 2862} 2863$AA.StyleAction.registerClass('Sys.Extended.UI.Animation.StyleAction', $AA.Action); 2864$AA.registerAnimation('styleAction', $AA.StyleAction); 2865 2866///<summary> 2867/// OpacityAction allows you to set the opacity of the target. 2868///</summary> 2869///<member name="cT:AjaxControlToolkit.OpacityAction" base="AjaxControlToolkit.Action" /> 2870 2871/// <summary /> 2872/// <member name="cM:AjaxControlToolkit.OpacityAction.ctor" /> 2873/// <param name="target" type="Object">Target of the animation.</param> 2874/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2875/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2876/// <param name="opacity" type="Number">Opacity to set the target.</param> 2877$AA.OpacityAction = function(target, duration, fps, opacity) { 2878 $AA.OpacityAction.initializeBase(this, [target, duration, fps]); 2879 2880 // Opacity 2881 this._opacity = opacity; 2882} 2883$AA.OpacityAction.prototype = { 2884 /// <summary> 2885 /// Sets the target element's opacity. 2886 /// </summary> 2887 /// <member name="cM:AjaxControlToolkit.OpacityAction.doAction" /> 2888 doAction: function() { 2889 var element = this.get_target(); 2890 if(element) { 2891 $common.setElementOpacity(element, this._opacity); 2892 } 2893 }, 2894 2895 ///<summary> 2896 /// The opacity value to set to the target element. 2897 ///</summary> 2898 ///<getter>get_opacity</getter> 2899 ///<setter>set_opacity</setter> 2900 ///<member name="cP:AjaxControlToolkit.OpacityAction.opacity" /> 2901 get_opacity: function() { 2902 return this._opacity; 2903 }, 2904 set_opacity: function(value) { 2905 value = this._getFloat(value); 2906 if(this._opacity != value) { 2907 this._opacity = value; 2908 this.raisePropertyChanged('opacity'); 2909 } 2910 } 2911} 2912$AA.OpacityAction.registerClass('Sys.Extended.UI.Animation.OpacityAction', $AA.Action); 2913$AA.registerAnimation('opacityAction', $AA.OpacityAction); 2914 2915///<summary> 2916/// The ScriptAction is used to execute arbitrary JavaScript. 2917///</summary> 2918///<member name="cT:AjaxControlToolkit.ScriptAction" base="AjaxControlToolkit.Action" /> 2919 2920/// <summary /> 2921/// <member name="cM:AjaxControlToolkit.ScriptAction.ctor" /> 2922/// <param name="target" type="Object">Target of the animation.</param> 2923/// <param name="duration" type="Number">Length of the animation in seconds. The default is 1.</param> 2924/// <param name="fps" type="Number">Number of steps per second. The default is 25.</param> 2925/// <param name="script" type="String">JavaScript to execute.</param> 2926$AA.ScriptAction = function(target, duration, fps, script) { 2927 $AA.ScriptAction.initializeBase(this, [target, duration, fps]); 2928 2929 // Script to execute 2930 this._script = script; 2931} 2932$AA.ScriptAction.prototype = { 2933 /// <summary> 2934 /// Executes the script. 2935 /// </summary> 2936 /// <member name="cM:AjaxControlToolkit.ScriptAction.doAction" /> 2937 doAction: function() { 2938 try { 2939 eval(this._script); 2940 } catch(ex) { 2941 } 2942 }, 2943 2944 ///<summary> 2945 /// JavaScript code to execute. 2946 ///</summary> 2947 ///<getter>get_script</getter> 2948 ///<setter>set_script</setter> 2949 ///<member name="cP:AjaxControlToolkit.ScriptAction.script" /> 2950 get_script: function() { 2951 return this._script; 2952 }, 2953 set_script: function(value) { 2954 if(this._script != value) { 2955 this._script = value; 2956 this.raisePropertyChanged('script'); 2957 } 2958 } 2959} 2960$AA.ScriptAction.registerClass('Sys.Extended.UI.Animation.ScriptAction', $AA.Action); 2961$AA.registerAnimation('scriptAction', $AA.ScriptAction); 2962 2963// globals 2964var $AA;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.