ChaosPro Home
Introduction
What's New
Palettes
Using Formulas
Layering in ChaosPro
Rendering
Fractal Parameter Windows
Windows
Menu
3D Transformations
Animations
Formula Compiler
Writing Formulas
Language Reference
Introduction
Basic Syntax
Datatypes
Constants
Variables
Expressions
Operators
Functions
Arithmetic
Conversion
Color
rgb
rgba
hsl
hsla
red
green
blue
alpha
hue
sat
lum
blend
compose
gradient
merge
Trigonometric
Miscellaneous
Control Structures
Compiler Directives
Functions
Interface to ChaosPro
Special Features, Notes...
Compatibility
Fractal Type Reference
Tutorials
Appendix
CHAOSPRO 4.0
Release 4.0
.

Predefined Functions - blend

Function name:blend - Interpolate colors
Synopsis:blend(col2,col2,pos)

Input data type Output data type
color, color, real color


Description:

This function interpolates the two colors in the RGBA colorspace using linear interpolation and returns the interpolated color at the given position. The third parameter specifies the position:

  • 0 means, the position is at the first color, i.e. the first color is returned.
  • 1 means, the position is at the second color, i.e. the second color is returned.
  • 0.5 means, the position is in the middle of the two colors, thus the interpolated color in the middle of the two colors will be returned.
Because this function simply performs linear interpolation on each component separately you can specify any value for the third parameter: So you can specify -0.5 as well, or 1.5. In this case the color at that location will be returned. This color is not between the two colors, but outside (extrapolation).

Examples:
  • blend( rgba(0.0, 1.0, 1.0, 1.0) ,
           rgba(1.0, 0.5, 0.0, 0.5) , 1 ) will return the second color, i.e. rgba(1.0, 0.5, 0.0, 0.5)
  • blend( rgba(0.0, 1.0, 1.0, 1.0) ,
           rgba(1.0, 0.5, 0.0, 0.5) , 0.5 ) will return the color, i.e. rgba(0.5, 0.75, 0.5, 0.75)
  • blend( rgba(0.0, 1.0, 1.0, 1.0) ,
           rgba(1.0, 0.5, 0.0, 0.5) , 2 ) will return the extrapolated color rgba(2.0, 0.0, -1.0, 0.0)