p

Reference one of the definition's props by name, wherever a word asks for a value.

p(name: string): PropRef

Import p from shaders/std.

Pass it where a std word takes a color, a position or a number and the word reads that prop live on the GPU. The name must be one of the definition's props; a wrong name throws when the shader is built.

Parameters

NameTypeNotes
namestring

Example

effect: tintToward(p('color'), {amount: p('intensity')})

Tip. A prop ref is a binding, not a snapshot: changing the prop later needs no rebuild.

See also

  • Scalar — A number built from props: what radialMask(…), motion.oscillating(…) and .times() return.
  • uniformOf — The live GPU value of a prop, for a hand-written builder: uniformOf(p('radius'), params).
  • ctx — The context values as tokens: ctx.uv, ctx.time, ctx.aspect, ctx.pointer, ctx.viewportSize, ctx.logicalViewportSize.

Used by

AngularBlur, Ascii, Aurora, BarShift, BarnDoors, Beam, Bend, Blob, BlockDissolve, BlockNoise, BlueNoise, Blur, BokehBlur, BrickPattern, BrightnessContrast, Bulge, CRTScreen, Chalkboard, ChannelBlur, CheckerWipe, Checkerboard, Chevron, ChromaticAberration, ColorWheel, CompressionArtifacts, ConcentricSpin, ConicGradient, ContourLines, CornerPin, CurlNoise, CursorRipples, DiamondGradient, DiamondWipe, DiffuseBlur, DisplacementMap, Dither, DotGrid, DropShadow, Duotone, Engraving, ErosionNoise, Exposure, FallingLines, FilmGrain, FilmStock, Flip, FlowField, FlowingGradient, FlutedGlass, FractalNoise, GaborNoise, GlassTiles, Glitch, Glow, Godrays, GradientMap, Grid, GridDistortion, Halftone, HexGrid, HueShift, ImageTexture, IrisWipe, IsometricCubes, Kaleidoscope, KeyFrames, LensDistortion, LensFlare, LightLeak, Line, LinearBlur, LinearGradient, LinearWipe, Liquify, Marble, MeshGradient, Mirror, MultiPointGradient, NoiseDissolve, ObjectTracker, Obsidian, PagePeel, PerlinNoise, Perspective, Pixelate, Plasma, PolarCoordinates, Posterize, Prism, ProgressiveBlur, RadialGradient, RadialWipe, RandomBars, RectangularCoordinates, ReflectivePlane, Repeater, RippleWipe, Ripples, Saturation, Scratches, Sharpness, SimplexNoise, SineWave, SliceWipe, Solarize, SolidColor, Spherize, Spiral, Strands, Stretch, Stripes, StudioBackground, SunBurst, Swirl, TiltShift, Tint, TriangularGrid, Tritone, Truchet, Twirl, VHS, VenetianBlinds, Vibrance, VideoTexture, Vignette, Voronoi, Voxels, Watercolor, WaveDistortion, Waveform, WaveletNoise, Weave, WebcamTexture, WorleyNoise, ZoomBlur