有没有做颜色循环在JavaScript的好方法? [英] Is there a good way to do color cycling in javascript?

查看:174
本文介绍了有没有做颜色循环在JavaScript的好方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我想要做的:我有一个HTML页面的文本行。我想有一段文字开始在给定的颜色,周期虽然频谱,等待一两秒钟,然后重复。

Here's what I'd like to do: I've got a line of text in an HTML page. I'd like to have that piece of text start at a given color, cycle though the spectrum, wait a second or two, and then repeat.

我想做到这一点在JavaScript如果可能的话(像闪光灯无法完全出了问题,但会是这个项目的一些主要范围蔓延。)

I'd like to do this in javascript if possible (something like flash isn't totally out of the question, but would be some major scope creep of this project.)

我知道足够JS知道这是可能的,但仅此而已。任何人都可以点我在正确的方向?

I know enough JS to know this is possible, but that's about it. Can anyone point me in the right direction?

是的,这是一个真正的客户端请求。我只是很高兴,他们也没问闪烁标记。 ;)

And yes, this is a real client request. I'm just glad they didn't also ask for the blink tag. ;)

推荐答案

浏览一些褪色的例子后,我们结束了jQuery的.animate()函数的这个颜色动画插件。作品壮观。

After browsing some of the "fading" examples, we ended up going with jQuery's .animate() function and this color animation plugin. Works spectacularly.

这篇关于有没有做颜色循环在JavaScript的好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆