Class: JuliaPreviewRenderer

JuliaPreviewRenderer()

Julia Set Preview Renderer (legacy)

Constructor

new JuliaPreviewRenderer()

Simplified renderer for Julia preview in Mandelbrot mode
Since:
  • 1.9
Author:
  • Radim Brnka
Source:

Extends

Classes

JuliaPreviewRenderer

Members

DEFAULT_C :COMPLEX

Type:
  • COMPLEX
Source:

DEFAULT_PAN :COMPLEX

Type:
  • COMPLEX
Overrides:
Source:

DIVES :Array.<DIVE>

Type:
  • Array.<DIVE>
Source:

PRESETS :Array.<JULIA_PRESET>

Type:
  • Array.<JULIA_PRESET>
Overrides:
Source:

_colorAnimationResolve

Resolve callback for pending color animation (to handle interruption)
Overrides:
Source:

adaptiveQualityEnabled

Runtime toggle for adaptive quality (initialized from constant)
Overrides:
Source:

adaptiveQualityLastAdjustment

Timestamp of last adaptive quality adjustment
Overrides:
Source:

adaptiveQualityMin

Runtime adjustable min iterations offset (initialized from constant)
Overrides:
Source:

c :COMPLEX

Type:
  • COMPLEX
Source:

colorPalette :PALETTE

Type:
  • PALETTE
Overrides:
Source:

iterations :number

Type:
  • number
Overrides:
Source:

pan :COMPLEX

Type:
  • COMPLEX
Overrides:
Source:

panDD

DD accumulator mirrors into this.pan
Overrides:
Source:

rotation :number

Rotation in rad
Type:
  • number
Overrides:
Source:

vertexShaderSource

Vertex shader
Overrides:
Source:

zoom :number

Type:
  • number
Overrides:
Source:

Methods

addPan(dx, dy) → {void}

Adjusts the pan values by adding the specified deltas to the current pan values.
Parameters:
Name Type Description
dx number The change in the x-direction to be added to the pan.
dy number The change in the y-direction to be added to the pan.
Overrides:
Source:
Returns:
Type
void

adjustAdaptiveQuality()

Adjusts extraIterations based on GPU performance metrics. Called after each frame when adaptive quality is enabled.
Overrides:
Source:

adjustAdaptiveQualityMin(delta)

Adjusts the minimum iterations offset for adaptive quality.
Parameters:
Name Type Description
delta number Amount to change (positive = less aggressive, negative = more aggressive)
Overrides:
Source:

adjustExtraIterations(delta)

Directly adjusts extraIterations for manual quality control. Useful for finding the right adaptiveQualityMin limit or boosting quality.
Parameters:
Name Type Description
delta number Amount to change (positive = more iterations, negative = fewer)
Overrides:
Source:

(async) animateColorPaletteTransition(newPalette, durationopt, coloringCallbackopt) → {Promise.<void>}

Updates the palette and redraws.
Parameters:
Name Type Attributes Default Description
newPalette Array.<number> | Float32Array The inner stops array (15 floats for 5 RGB colors)
duration number <optional>
250 Ignored for preview (instant transition)
coloringCallback function <optional>
null Callback after palette change
Overrides:
Source:
Returns:
Type
Promise.<void>

(async) animateFullColorSpaceCycle(durationopt, coloringCallbackopt) → {Promise.<void>}

Animates fractalApp.colorPalette by cycling through the entire color space. The palette will continuously change hue from 0 to 360 degrees and starts from the current palette
Parameters:
Name Type Attributes Default Description
duration number <optional>
15000 Duration (in milliseconds) for one full color cycle.
coloringCallback function <optional>
null
Overrides:
Source:
Returns:
Type
Promise.<void>

(async) animatePaletteByIdTransition(preset, duration, coloringCallback) → {Promise.<void>}

Transitions between palettes by their unique identifiers, animating the change over the specified duration.
Parameters:
Name Type Description
preset PRESET The configuration object containing the palette definition.
Properties
Name Type Description
paletteId string The unique identifier for the target palette.
duration number The duration of the animation in milliseconds.
coloringCallback function
Overrides:
Source:
Returns:
Resolves once the palette transition animation is complete.
Type
Promise.<void>

(async) animatePanAndZoomTo(targetPan, targetZoom, durationopt, easeFunction) → {Promise.<void>}

Animates pan and zoom simultaneously.
Parameters:
Name Type Attributes Default Description
targetPan COMPLEX
targetZoom number
duration number <optional>
1000 in milliseconds
easeFunction EASE_TYPE | function
Overrides:
Source:
Returns:
Type
Promise.<void>

(async) animatePanBy(deltaPan, durationopt, easeFunction) → {Promise}

Animates pan by a delta (DD-stable). Unlike animatePanTo, this avoids computing targetPan = startPan + delta in a single float64 operation (which breaks in deep zoom). This method applies incremental DD pan updates based on animation progress.
Parameters:
Name Type Attributes Default Description
deltaPan COMPLEX
duration <optional>
200 in ms
easeFunction EASE_TYPE | function
Overrides:
Source:
Returns:
Type
Promise

(async) animatePanByAndZoomTo(deltaPan, targetZoom, durationopt, easeFunction) → {Promise.<void>}

Animates pan by delta and zoom simultaneously. Uses addPan() internally to preserve DD precision at deep zoom levels.
Parameters:
Name Type Attributes Default Description
deltaPan COMPLEX offset to add to current pan
targetZoom number
duration number <optional>
1000 in milliseconds
easeFunction EASE_TYPE | function
Overrides:
Source:
Returns:
Type
Promise.<void>

(async) animatePanThenZoomTo(targetPan, targetZoom, panDuration, zoomDuration, easeFunction) → {Promise.<void>}

Animates sequential pan and then zooms into the target location.
Parameters:
Name Type Description
targetPan COMPLEX
targetZoom number
panDuration number in milliseconds
zoomDuration number in milliseconds
easeFunction EASE_TYPE | function
Overrides:
Source:
Returns:
Type
Promise.<void>

(async) animatePanTo(targetPan, durationopt, easeFunction) → {Promise.<void>}

Animates pan from current position to the new one
Parameters:
Name Type Attributes Default Description
targetPan COMPLEX
duration <optional>
200 in ms
easeFunction EASE_TYPE | function
Overrides:
Source:
Returns:
Type
Promise.<void>

(async) animateZoomTo(targetZoom, durationopt, easeFunction, anchorXopt, anchorYopt)

Animates zoom while keeping the fractal point under an anchor screen coordinate fixed.
Parameters:
Name Type Attributes Default Description
targetZoom number
duration number <optional>
500
easeFunction EASE_TYPE | function
anchorX number | null <optional>
null CSS px relative to canvas; defaults to canvas center
anchorY number | null <optional>
null CSS px relative to canvas; defaults to canvas center
Overrides:
Source:

(async) animateZoomToNoPan(targetZoom, durationopt, easeFunctionopt) → {Promise.<void>}

Animates zoom from current value to target zoom without adjusting pan position. Unlike animateZoomTo, this method does not keep any anchor point fixed during zooming. The fractal will appear to zoom in/out from its current center position.
Parameters:
Name Type Attributes Default Description
targetZoom number The target zoom level to animate to
duration number <optional>
500 Duration of the animation in milliseconds
easeFunction EASE_TYPE | function <optional>
EASE_TYPE.NONE Easing function to apply; EASE_TYPE.NONE uses exponential interpolation
Overrides:
Source:
Returns:
Promise that resolves when the animation completes
Type
Promise.<void>

compileShader(source, type) → {WebGLShader|null}

Compiles shader code
Parameters:
Name Type Description
source string
type GLenum
Overrides:
Source:
Returns:
Type
WebGLShader | null

createFragmentShaderSource() → {string}

Defines the shader code for rendering the fractal shape
Overrides:
Source:
Returns:
Type
string

destroy()

Destructor
Overrides:
Source:

draw()

Draws the fractal and sets basic uniforms. Subclasses can override draw() but must call super.draw() for viewport+common uniforms+draw call. Uses dirty checking to avoid redundant uniform uploads.
Overrides:
Source:

getCanvasCssCenter() → {Array.<number>}

Compute CSS-space center of the canvas (for default anchored zoom).
Overrides:
Source:
Returns:
Type
Array.<number>

getPan() → {Array.<number>}

Overrides:
Source:
Returns:
the canonical array
Type
Array.<number>

initGLProgram()

Initializes WebGL program, shaders, quad, and uniform caches.
Overrides:
Source:

invalidateUniformCache()

Invalidates the uniform cache, forcing all uniforms to be re-uploaded on next draw(). Called after GL program creation/recreation.
Overrides:
Source:

markOrbitDirty()

Hook for perturbation renderers to request orbit rebuild. No-op by default.
Overrides:
Source:

(abstract) needsRebase()

kept for compatibility; perturbation renderers may ignore
Overrides:
Source:

noteInteraction(settleMs)

Marks the app as "in interaction" (drag/wheel/key-pan) and schedules a settle phase. Perturbation renderers can use this to defer expensive orbit rebuilds until the user stops moving.
Parameters:
Name Type Default Description
settleMs number 160
Overrides:
Source:

onAnimationFinished()

Default callback after every animation that requires on-screen info update
Overrides:
Source:

(abstract) onProgramCreated()

Overrides:
Source:

reset()

Resets the fractal to its initial state (default pan, zoom, palette, rotation, etc.), resizes and redraws.
Overrides:
Source:

screenToFractal(screenX, screenY) → {COMPLEX}

Screen point -> fractal coordinates (float64 JS side; fine for UI)
Parameters:
Name Type Description
screenX number
screenY number
Overrides:
Source:
Returns:
Type
COMPLEX

screenToPanDelta(screenX, screenY) → {COMPLEX}

Returns the pan delta needed to center on a screen point. This avoids precision loss at deep zoom by returning only the offset, which can be applied via addPan() to preserve DD precision.
Parameters:
Name Type Description
screenX number CSS px relative to canvas
screenY number CSS px relative to canvas
Overrides:
Source:
Returns:
[deltaX, deltaY] offset from current pan
Type
COMPLEX

screenToViewVector(screenX, screenY) → {Array.<number>}

Convert a screen point to the rotated, aspect-corrected "view vector" (no pan/zoom applied). This is exactly what your shader calls `rotated`.
Parameters:
Name Type Description
screenX number CSS pixels relative to canvas (like your handlers use)
screenY number CSS pixels relative to canvas
Overrides:
Source:
Returns:
view-space rotated vector
Type
Array.<number>

setPan(x, y) → {void}

Sets the pan values for the object.
Parameters:
Name Type Description
x number The horizontal pan value.
y number The vertical pan value.
Overrides:
Source:
Returns:
Type
void

setPanFromAnchor()

Set pan so that fractal point (fxAnchor,fyAnchor) remains under a screen point whose view vector is (vx,vy).
Overrides:
Source:

setZoomKeepingAnchor(targetZoom, anchorX, anchorY)

Sets zoom while keeping the fractal point under a given screen anchor fixed. Uses DD-preserving arithmetic to avoid precision loss at deep zoom.
Parameters:
Name Type Description
targetZoom number
anchorX number CSS px relative to canvas
anchorY number CSS px relative to canvas
Overrides:
Source:

(async) startPaletteCycling(transitionDurationopt, holdDurationopt, coloringCallbackopt, onPaletteCompleteopt) → {Promise.<void>}

Starts continuous sequential palette cycling. Smoothly transitions through all palettes in order, looping indefinitely.
Parameters:
Name Type Attributes Default Description
transitionDuration number <optional>
2000 Duration for each palette transition in ms.
holdDuration number <optional>
3000 Duration to hold each palette before transitioning.
coloringCallback function <optional>
null Callback during transitions (called per frame).
onPaletteComplete function <optional>
null Callback when each palette transition completes.
Overrides:
Source:
Returns:
Type
Promise.<void>

stopAllNonColorAnimations()

Stops all currently running animations that are not a color transition
Overrides:
Source:

stopCurrentColorAnimations()

Stops currently running color animation
Overrides:
Source:

stopCurrentPanAnimation()

Stops currently running pan animation
Overrides:
Source:

stopCurrentRotationAnimation()

Stops currently running rotation animation
Overrides:
Source:

stopCurrentZoomAnimation()

Stops currently running zoom animation
Overrides:
Source:

stopDemo()

Stops current demo and resets demo variables
Overrides:
Source:

toggleAdaptiveQuality()

Toggles adaptive quality on/off. When turning off, resets extraIterations to 0.
Overrides:
Source:

updateUniforms()

Cache common uniforms used by all renderers
Overrides:
Source: