Name
CyclePalette -- cycle palette colors (V9.0)
Synopsis
CyclePalette(id, start, end[, repeat])
Library
palette

Function
This function cycles the palette colors between the pen specified by start and the pen specified by end. If end is greater than start, all pens starting at the index start will be shifted to the right and wrap at the pen specified by end. If start is greater than end, pens will be cycled in reverse, i.e. they will be shifted to the left, wrapping at the pen index specified by start. The repeat argument can be used to specify how many times the cycling should be repeated. This defaults to 1 which means that colors should only be cycled once.

Inputs
id
identifier of the palette whose pens should be cycled
start
start pen of cycling range
end
end pen of cycling range
repeat
optional: number of times to repeat cycling (defaults to 1)
Example
@DISPLAY {Palette = #PALETTE_CGA}
SetFont(#SANS, 96)
SetPaletteMode(#PALETTEMODE_PEN)
t$ = "Hollywood"
For Local k = 0 To StrLen(t$) - 1
    SetDrawPen(k + 2)
    Print(MidStr(t$, k, 1))
Next
ExtractPalette(1, #BGPIC, 1)
StartTimer(1)
Repeat
    CyclePalette(1, 2, 10)
    SetPalette(1)
    WaitTimer(1, 80)
Forever
The code above prints the individual of characters of the string "Hollywood" in different colors and then cycles their colors.

Show TOC