纳金网

标题: HSV Colors (Script Utilities Behavior) [打印本页]

作者: Asen    时间: 2011-10-21 08:22
标题: HSV Colors (Script Utilities Behavior)






               HSV Colors (Script Utilities Behavior)
              









           Summary
         

           Extends all Color objects to support hue/saturation/value properties.
         





               Category
              


              Latest Behaviors
            




               Author
              


              Gavin Kistner
            




               Difficulty
              


              (Reference)
            




               Time to Complete
              


              5 Minutes
            








           Downloads
         


            Click Here
           
           to download the associated files.
         


            (This document covers version 1.0 of the 'HSV Colors' behavior, current as of 2005-Feb-11)
           

            Description
           


             This utility library extends Color objects to support
            
              .h
            
             ,
            
              .s
            
             , and
            
              .v
            
             properties for
            
              HSV
            
             (Hue, Saturation, Value) manipulations.
            

             Hue values are specified and returned as numbers in the range 0..360, with pure red being 0, pure green 120, and pure blue 240.
            

             Saturation and Value values are specified and returned as numbers in the range 0..100.
            

             To use, simply attach this behavior anywhere in the scene. (You have to actually attach it to add the functionality; loading it into the library for the project is not enough.)
            
            Example code:
            
             //Set the material to a dark red color
myMaterial.diffuse = new Color( 150, 0, 0 );

var theColor = myMaterial.diffuse;
alert(theColor.h+', '+theColor.h+', '+theColor.v);
//alerts "0, 0, 58.82352941176471"

theColor.h = 120;
//theColor is now 0, 150, 0

theColor.h = 30;
//theColor is now 150, 75, 0

theColor.v = 100
//theColor is now 255, 128, 0

theColor.s = 50;
//theColor is now 255 192 128
            

             Note that changes to the hue or saturation do not take effect when the value is exactly 0, and changes to the hue will not take effect when the saturation is 0.
            


            Demonstration
           




              View Demonstration Project
            




              Download Project File
            




作者: C.R.CAN    时间: 2012-3-13 23:19
水……生命之源……灌……

作者: tc    时间: 2012-3-23 23:20
不错 非常经典  实用

作者: 菜刀吻电线    时间: 2012-3-25 23:26
爱咋咋地!

作者: 晃晃    时间: 2012-4-5 23:33
水。。。

作者: tc    时间: 2012-4-11 23:21
先顶上去,偶要高亮加精鸟!

作者: 晃晃    时间: 2012-8-22 00:13
非常感谢,管理员设置了需要对新回复进行审核,您的帖子通过审核后将被显示出来,现在将转入主题

作者: 菜刀吻电线    时间: 2012-9-1 01:05
无聊时可以刷屏幕 灌水 也可以试试 帖子的标题究竟可以写多长

作者: C.R.CAN    时间: 2012-9-4 23:18
好铁多多发,感激分享

作者: C.R.CAN    时间: 2012-10-18 23:26
好`我顶``顶顶

作者: 菜刀吻电线    时间: 2012-11-10 23:26
“再次路过……”我造一个-----特别路过

作者: 晃晃    时间: 2012-11-14 04:01
呵呵,真得不错哦!!

作者: 菜刀吻电线    时间: 2013-2-16 23:36
凡系斑竹滴话要听;凡系朋友滴帖要顶!

作者: C.R.CAN    时间: 2013-2-23 23:24
不错哦,顶一下......





欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5