AAtitit. special effect on changing color over time --- planning titit of the box management system. With aatitittitit
Atitit. Special Effects on changing colors over time --- plan the box Management System
1. Process titrator
The defined parameter color and position (start value, end value, current ratio) "returns a value.
It can be converted to a dual-bit hexadecimal code after processing
Define the composite color, each monochrome value, and then join
Callback event, the object to be applied ..
2. required functions
Suspend Function
Added time functions in a unified manner
Unified time reduction
Author: old wow's paw Attilax iron, EMAIL: 1466519819@qq.com
Reprinted please indicate Source: http://blog.csdn.net/attilax
3 Overview image:
4 --- code
Function getCurVal (startVal, endVal, percent)
{
Var rang = Math. abs (startVal-endVal );
Var adjus_count = Math. round (percent * rang );
If (startVal> endVal) // reduce
Varcur_val = startVal-adjus_count;
Else // up load
Var cur_val = startVal + adjus_count;
Return cur_val;
}
5 --- code22
Var min_color = 121;
Var max_color = 240;
Var finish_percent = past_time/dura;
Var remain_prercent = remain_time/dura;
// Sec color
Var finishi_color_oct = Math. round (finish_percent * 5 );
Var finishi_color_hex = str_pad (finishi_color_oct.toString (16), 2, "0", STR_PAD_LEFT );
// Fist cloor
Var rang = max_color-min_color;
Var adjus_count = Math. round (remain_prercent * rang );
Var remain_color_ocr = 121 + adjus_count;
Var remain_color_hex = str_pad (remain_color_ocr.toString (16), 2, "0", STR_PAD_LEFT );
// Finishi_color_hex = "00 ";
Var blue_str = "#" + finishi_color_hex + remain_color_hex + "00 ";
If (remain_time> 0 ){
((Element).css ("background-image", "none ");
((Element).css ("background-color", blue_str );
}
Zookeeper
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.