HTML那个函数用于实现平移,html练习

16.}

17.

18.var Map = function(array, callback, thisObject){

19. if(array.map){

20. return array.map(callback, thisObject);

21. }else{

22. var res = [];

23. for (var i = 0, len = array.length; i < len; i++) { res

.push(callback.call(thisObject, array[i], i, array)); }

24. return res;

25. }

26.}

27.

28.

29.var ColorGrads = function(options){

30. this.SetOptions(options);

31. this.StartColor = this.options.StartColor;

32. this.EndColor = this.options.EndColor;

33. this.Step = Math.abs(this.options.Step);

34.};

35.ColorGrads.prototype = {

36. //设置默认属性

37. SetOptions: function(options) {

38. this.options = {//默认值

39. StartColor: "#fff",//开始颜色

40. EndColor: "#000",//结束颜色

41. Step: 20//渐变级数

42. };

43. Extend(this.options, options || {});

44. },

45. //获取渐变颜色集合

46. Create: function() {

47. var colors = [],

48. startColor = this.GetColor(this.StartColor),

49. endColor = this.GetColor(this.EndColor),

50. stepR = (endColor[0] - startColor[0]) / this.Step,

51. stepG = (endColor[1] - startColor[1]) / this.Step,

52. stepB = (endColor[2] - startColor[2]) / this.Step;

53. //生成颜色集合

54. for(var i = 0, n = this.Step, r = startColor[0], g = startC

olor[1], b = startColor[2]; i < n; i++){

55. colors.push([r, g, b]); r += stepR; g += stepG; b += st

epB;

56. }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值