0
A
回答
0
這是做彩色週期所提到的網站上的代碼:
Module("GradientCycle", {
bones: "<div></div>",
noGradient: "Please use a modern browser (like Chrome, Firefox or Safari) to fully enjoy this site",
saturation: 0.5,
value: 1,
angle: 120,
loopSpeed: 50,
webkitCSS: "-webkit-gradient(linear, left bottom, left top,color-stop(0, rgb(RGB1)),color-stop(.5, rgb(RGB2)),color-stop(1, rgb(RGB3)))",
geckoCSS: "-moz-linear-gradient(center bottom,rgb(RGB1) 0%,rgb(RGB2) 50%,rgb(RGB3) 100%);",
init: function() {
this.css = this.testCSS();
this.seed = this.hue || Math.floor(Math.random() * 360)
},
testCSS: function() {
return $("html").hasClass("webkit") ? this.webkitCSS : $("html").hasClass("gecko") ? this.geckoCSS : null
},
setCol: function() {
var e = (++this.seed) % 360,
m = this.saturation,
l = this.value,
k = this.angle,
j = (e + 180 + k) % 360,
g = (e + 180 - k) % 360,
d = hsvToRgb(e/360, m, l),
c = hsvToRgb(j/360, m, l),
b = hsvToRgb(g/360, m, l),
f = this.css.replace(/RGB1/, d.join(",")).replace(/RGB2/, c.join(",")).replace(/RGB3/, b.join(","));
this.$.attr("style", "background:" + f);
return this
},
start: function() {
if (!this.css) {
return this.$.html(this.noGradient)
}
this.stop();
this.loop = setInterval($.proxy(this.setCol, this), this.loopSpeed);
return this
},
stop: function() {
clearInterval(this.loop);
return this
}
});
基本上它歸結爲修改CSS3漸變的色值。
相關問題
- 1. CSS3旋轉梯度
- 2. 火狐的動畫/梯度CSS3支持
- 3. 背景圖像底部梯度CSS3
- 4. CSS3線性梯度純色大小
- 5. css3背景徑向圓梯度
- 6. 循環CSS3轉換
- 7. 循環CSS3動畫
- 8. WebKit的CSS3動畫循環
- 9. CSS3背景角度的梯度上的寬屏變成水平
- 10. CSS3線性梯度100%的高度不固定
- 11. 如何循環css3動畫?
- 12. CSS3無限循環動畫
- 13. 循環的JavaScript
- 14. 的JavaScript ...循環
- 15. CSS/JavaScript的動態梯度或陰影
- 16. JavaScript for循環不循環
- 17. for循環for循環? - Javascript
- 18. 循環使用javascript循環使用javascript
- 19. three.js天梯與梯度
- 20. JavaScript for循環數組長度
- 21. 通過循環計算總高度Javascript
- 22. Css3:帶邊框的右梯形
- 23. 測試CSS3徑向梯度供應商語法
- 24. 循環調度
- 25. 循環調度
- 26. 循環調度
- 27. 的Javascript while循環無限循環
- 28. For循環在Javascript中的for循環
- 29. JavaScript - for循環中的循環按鈕
- 30. 的Javascript關閉:循環內循環
- 謝謝。不知道如何在標題中實現這樣的東西。任何想法? – Nitzan