[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 /* 2 YUI 3.17.2 (build 9c3c78e) 3 Copyright 2014 Yahoo! Inc. All rights reserved. 4 Licensed under the BSD License. 5 http://yuilibrary.com/license/ 6 */ 7 8 YUI.add('anim-color', function (Y, NAME) { 9 10 /** 11 * Adds support for color properties in <code>to</code> 12 * and <code>from</code> attributes. 13 * @module anim 14 * @submodule anim-color 15 */ 16 17 var NUM = Number; 18 19 Y.Anim.getUpdatedColorValue = function(fromColor, toColor, elapsed, duration, fn) 20 { 21 fromColor = Y.Color.re_RGB.exec(Y.Color.toRGB(fromColor)); 22 toColor = Y.Color.re_RGB.exec(Y.Color.toRGB(toColor)); 23 24 if (!fromColor || fromColor.length < 3 || !toColor || toColor.length < 3) { 25 Y.error('invalid from or to passed to color behavior'); 26 } 27 28 return 'rgb(' + [ 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)) 32 ].join(', ') + ')'; 33 }; 34 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)); 38 }, 39 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; 44 return val; 45 } 46 }; 47 48 Y.each(['backgroundColor', 49 'borderColor', 50 'borderTopColor', 51 'borderRightColor', 52 'borderBottomColor', 53 'borderLeftColor'], 54 function(v) { 55 Y.Anim.behaviors[v] = Y.Anim.behaviors.color; 56 } 57 ); 58 59 60 }, '3.17.2', {"requires": ["anim-base"]});
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |