2005
06.09

AS request : color

elnézést a ronda kódért. nagyon rég irtam, kicsit poros.

ez e

as alább

van ilyen random rgb. nem mondom szebbet is láttam már.
function rRgb() {
var rr=random(255).toString(16)
var rg=random(255).toString(16)
var rb=random(255).toString(16)
if (rr.length<2) {rr="0"+rr}
if (rg.length<2) {rg="0"+rg}
if (rb.length<2) {rb="0"+rb}
return rr+""+rg+""+rb
}

a másik meg colorfade, szintén nem a mai kategoriából.
MovieClip.prototype.colorFade=function(tc,lc,t) {
clearInterval(this.fcfi)
if (!t) {t=10}
this.myc = new Color(this);
this.ac=this.myc.getRGB().toString(16)
while((6-this.ac.length)!=0){this.ac="0"+this.ac}
this.ar=parseInt(this.ac.substring(0,2),16)
this.ag=parseInt(this.ac.substring(2,4),16)
this.ab=parseInt(this.ac.substring(4,6),16)
this.tr=parseInt(tc.substring(0,2),16)
this.tg=parseInt(tc.substring(2,4),16)
this.tb=parseInt(tc.substring(4,6),16)
this.dr=(this.tr-this.ar)/lc
this.dg=(this.tg-this.ag)/lc
this.db=(this.tb-this.ab)/lc
this.flc=0
this.fcf=function (me) {
me.cout=lc+"/"+(me.flc+1)
me.flc++
me.cr=int(me.ar+me.flc*me.dr).toString(16)
me.cg=int(me.ag+me.flc*me.dg).toString(16)
me.cb=int(me.ab+me.flc*me.db).toString(16)
if (me.cr.length<2) {me.cr="0"+me.cr}
if (me.cg.length<2) {me.cg="0"+me.cg}
if (me.cb.length<2) {me.cb="0"+me.cb}
me.nc="0x"+me.cr+""+me.cg+""+me.cb
me.myc.setRGB(me.nc)
if(me.flc==lc){
clearInterval(me.fcfi)
me.cfDone()
}
}
this.fcfi=setInterval(this.fcf,t,this)
}

használhatod pl:
mc1.colorFade(rRgb(),50+random(50))

majd a nyáron frissítem őket.

No Comment.

Add Your Comment