|
发表于 2021-6-15 14:51:43
|
显示全部楼层
江苏省苏州市
10.(function() {
11. 'use strict';
12. // Your code here...
13. function gradientColor(startClr, endClr, step) {
14. var startR = startClr >> 16 & 255;
15. var startG = startClr >> 8 & 255;
16. var startB = startClr & 255;
17. var endR = endClr >> 16 & 255;
18. var endG = endClr >> 8 & 255;
19. var endB = endClr & 255;
20. var sR = endR - startR;
21. var sG = endG - startG;
22. var sB = endB - startB;
23. //console.log('' + sR + '-' + sG + '-' + sB);
24. var arrClr = [];
25. for (var i = 0; i <= step; i++) arrClr.push(startR + sR * i / step << 16 | startG + sG * i / step << 8 | startB + sB * i / step);
26. return arrClr;
27. }
28.
29. function fullHex(value) {
30. var map = '000000';
31. var temp = value.toString(16);
32. var len = temp.length;
33. if (len < 6) temp = '000000'.substr(len - 6) + temp;
34. return temp;
35. }
36. $("vfastpostform").submit = function() {
37. var str = $('vmessage').value;
38. var len = str.length;
39. var arrClr = gradientColor(0xff00ff, 0xff00, len);
40. var str2 = '';
41. for (var i = 0; i < len; i++) {
42. str2 += '[color=#' + fullHex(arrClr) + ']' + str.substr(i, 1) + '';
43. }
44. $('fastpostmessage').value = str2;
45. $('fastpostform').submit();
46. }
47.})();
|
|