算法的问题:需要动态地从00FF00增量FF0000随着时间的推移,C#/ Java的 [英] Algorithm Question: Need to dynamically INCREMENT from 00FF00 to FF0000 over TIME, C#/Java

查看:202
本文介绍了算法的问题:需要动态地从00FF00增量FF0000随着时间的推移,C#/ Java的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变颜色明亮的绿色到深红随着时间的推移(240小时)。我能看到的最好的方法是从00FF00改变六角组合到FF0000。

I want to change the color Bright Green to Dark Red over time (240 hours). The best way I can see is to change the hex combo from 00FF00 to FF0000.

我不知道如何动态计数到FF0000从00FF00为我的生活。我期待在10天的时间,因此极有可能超过240小时递增。

I don't know how to dynamically count up to FF0000 from 00FF00 for the life of me. I'm looking over a 10 day period, so most likely over 240 hours to increment.

谁能帮我?

我从来没有把一个算法类,所以我觉得可能有一些与此有关的问题。

I never took an algorithms class so I think that might have something to do with this problem.

如果你有更好的方法来做到这一点,然后让我知道。

If you have a better way to do this, then let me know.

我要寻找某种code在这里。多谢你们。它可以是任何语言,但是将不可避免地被转换为C#。

I am looking for some kind of code here. Thanks guys. It can be in any language but will inevitably be converted to C#.

推荐答案

试想一下,在组件方面。虽然它看起来像一个大的十六进制数,它实际上是三个并排的一面。

Just think about it in terms of the components. Even though it looks like one big hex number, it's actually three side-by-side.

在开始时,红色是0,绿色是255(FF),蓝色是0。
最后,红色255,绿色0,蓝色是0。

At the start, red is 0, green is 255 (FF), blue is 0.
At the end, red is 255, green is 0, blue is 0.

所以,每次(的时间你/ 255),红加1和减绿1。

So, every (amount of time you have / 255), increment red by 1 and decrement green by 1.

这篇关于算法的问题:需要动态地从00FF00增量FF0000随着时间的推移,C#/ Java的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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