2
YUI 3.13.0 (build 508226d)
3
Copyright 2013 Yahoo! Inc. All rights reserved.
4
Licensed under the BSD License.
5
http://yuilibrary.com/license/
8
YUI.add('anim-color', function (Y, NAME) {
11
* Adds support for color properties in <code>to</code>
12
* and <code>from</code> attributes.
14
* @submodule anim-color
19
Y.Anim.getUpdatedColorValue = function(fromColor, toColor, elapsed, duration, fn)
21
fromColor = Y.Color.re_RGB.exec(Y.Color.toRGB(fromColor));
22
toColor = Y.Color.re_RGB.exec(Y.Color.toRGB(toColor));
24
if (!fromColor || fromColor.length < 3 || !toColor || toColor.length < 3) {
25
Y.error('invalid from or to passed to color behavior');
29
Math.floor(fn(elapsed, NUM(fromColor[1]), NUM(toColor[1]) - NUM(fromColor[1]), duration)),
30
Math.floor(fn(elapsed, NUM(fromColor[2]), NUM(toColor[2]) - NUM(fromColor[2]), duration)),
31
Math.floor(fn(elapsed, NUM(fromColor[3]), NUM(toColor[3]) - NUM(fromColor[3]), duration))
35
Y.Anim.behaviors.color = {
36
set: function(anim, att, from, to, elapsed, duration, fn) {
37
anim._node.setStyle(att, Y.Anim.getUpdatedColorValue(from, to, elapsed, duration, fn));
40
// TODO: default bgcolor const
41
get: function(anim, att) {
42
var val = anim._node.getComputedStyle(att);
43
val = (val === 'transparent') ? 'rgb(255, 255, 255)' : val;
48
Y.each(['backgroundColor',
55
Y.Anim.behaviors[v] = Y.Anim.behaviors.color;
60
}, '3.13.0', {"requires": ["anim-base"]});