# Avoid colours in color tween

**URL:** <https://forum.kirupa.com/t/avoid-colours-in-color-tween/213839>\
**Category:** Uncategorized\
**Created:** [January 23, 2007, 6:17pm UTC](https://forum.kirupa.com/t/avoid-colours-in-color-tween/213839 "2007-01-23T18:17:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpelland](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@mpelland](https://forum.kirupa.com/u/mpelland)\
**Post date:** [January 23, 2007, 6:17pm UTC](https://forum.kirupa.com/t/avoid-colours-in-color-tween/213839/1 "2007-01-23T18:17:37Z")

</div>

hey all,  
I am using a slightly modified script from senocular for transitioning color transforms. the issue is that if i tween from blue to red or vice versa, the colour transitions through green. is there a way around that?

here is the function that i use

```auto

private function blendRGB(clipColor, c1, c2, t) {
        
        if (arguments.length == 3){
            t = c2;
            c2 = clipColor;
        }
        
        if (t<-1) t=-1;
        else if (t>1) t=1;
        if (t<0) t=1+t;
        
        var ct = {};
        
        //c1 = c1.getTransform();
        c2 = c2.getTransform();
        
        for (var p in c1) ct[p] = c1[p]+(c2[p]-c1[p]) * t;
        
        clipColor.setTransform(ct);
        
        return ct;
    }

```
