RenderLinearBlend¶
Under Construction
This documentation is auto-generated, and is a work in progress. Please see the source code at https://github.com/phetsims/alpenglow/blob/main/js/render-program/RenderLinearBlend.ts for the most up-to-date information.
Overview¶
RenderProgram for a linear blend (essentially a chunk of a linear gradient with only a linear transition between two things.
RenderLinearBlend will interpolate between two different RenderPrograms based on the location. It will evaluate clamp( dot( scaledNormal, point ) - offset, 0, 1 )
, and will linearly blend between the "zero" program (when the value is 0) and the "one" program (when the value is 1).
It can be used in a standalone way, however it is primarily meant to be used when a RenderLinearGradient is split into each linear segment.
@author Jonathan Olson <jonathan.olson@colorado.edu>
Class RenderInstructionLinearBlend¶
Takes t
value from vector.x. If t <= 0 or t >= 1, it will only return the "top" value NOTE: This is used by things in radial blends too, since it is linear at that point
Instance Methods¶
toString() : string¶
equals( other : RenderInstruction, areLocationsEqual : ( a: RenderInstructionLocation, b: RenderInstructionLocation ) => boolean ) : boolean¶
execute( stack : RenderExecutionStack, context : RenderEvaluationContext, executor : RenderExecutor )¶
( t, oneColor, zeroColor -- color )
writeBinary( encoder : ByteEncoder, getOffset : ( location: RenderInstructionLocation ) => number )¶
getBinaryLength() : number¶
Static Properties¶
INSTANCE : RenderInstructionLinearBlend¶
(readonly)
Class RenderLinearBlend¶
Constructor¶
new RenderLinearBlend( scaledNormal : Vector2, offset : number, accuracy : RenderLinearBlendAccuracy, zero : RenderProgram, one : RenderProgram, logic? : RenderLinearBlendLogic )¶
Instance Methods¶
getName() : string¶
withChildren( children : RenderProgram[] ) : RenderLinearBlend¶
transformed( transform : Matrix3 ) : RenderProgram¶
equalsTyped( other : this ) : boolean¶
(protected)
getSimplified( children : RenderProgram[] ) : RenderProgram | null¶
(protected)
evaluate( context : RenderEvaluationContext ) : Vector4¶
writeInstructions( instructions : RenderInstruction[] )¶
serialize() : SerializedRenderLinearBlend¶
Instance Properties¶
logic : RenderLinearBlendLogic¶
(readonly)
Type SerializedRenderLinearBlend¶
- type: "RenderLinearBlend"
- scaledNormal: number[]
- offset: number
- accuracy: RenderLinearBlendAccuracy
- zero: SerializedRenderProgram
- one: SerializedRenderProgram
Source Code¶
See the source for RenderLinearBlend.ts in the alpenglow repository.