# Color Morph

**URL:** <https://forum.kirupa.com/t/color-morph/132608>\
**Category:** Uncategorized\
**Created:** [December 30, 2004, 11:40am UTC](https://forum.kirupa.com/t/color-morph/132608 "2004-12-30T11:40:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Voetsjoeba](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@Voetsjoeba](https://forum.kirupa.com/u/Voetsjoeba)\
**Post date:** [December 30, 2004, 11:40am UTC](https://forum.kirupa.com/t/color-morph/132608/1 "2004-12-30T11:40:15Z")

</div>

A very simple prototype to morh a Color object’s color into a provided RGB value, again using my own easing formula. This once again proves that it can be used to ease almost anything.

```auto

 Color.prototype.morphTo = function(R, G, B, A){
     aux = _root.createEmptyMovieClip("__colormorph",-999);
     aux.ref = this;
     aux.onEnterFrame = function(){
         curColor = this.ref.getTransform();
         curra = curColor.ra;
         curga = curColor.ga;
         curba = curColor.ba;
         curaa = curColor.aa;
         this.ref.setTransform({ra:R-(R-curra)/1.1, ga:G-(G-curga)/1.1, ba:B-(B-curba)/1.1, aa:A-(A-curaa)/1.1});
     }
 }
 

```

Example demonstrating this prototype:

[swf=http://www.voetsjoeba.com/lab/view/colorfade.swf]width=760 height=420[/swf]

Source: [http://www.voetsjoeba.com/lab/source/colorfade.fla](http://www.voetsjoeba.com/lab/source/colorfade.fla)
