PixelKit Demos

Color Gradient

pod 'PixelKit'
import PixelKit
let gradient1 = GradientPIX(res: .fullscreen)
gradient1.direction = .radial
gradient1.scale = PIX.Res.fullscreen.aspect
gradient1.colorSteps = [
    ColorStep(0.0, .white),
    ColorStep(1.0, .black)
]
gradient1.extendRamp = .mirror
gradient1.offset = .live / 10

let quantize = QuantizePIX()
quantize.inPix = gradient1
quantize.fraction = 0.125

let gradient2 = GradientPIX(res: .fullscreen)
gradient2.direction = .horizontal
gradient2.colorSteps = [
    ColorStep(0.0, .black),
    ColorStep(0.25, .red),
    ColorStep(0.5, .orange),
    ColorStep(0.75, .yellow),
    ColorStep(1.0, .white)
]

let lookup = LookupPIX()
lookup.inPixA = quantize
lookup.inPixB = gradient2

let finalPix: PIX = lookup
finalPix.view.frame = view.bounds
view.addSubview(finalPix.view)
Created by Hexagons