On this page:
derived-visual
derived-visual?
derived-context?
derived-context-value-has?
derived-context-value-ref
derived-context-visual-has?
derived-context-visual-ref
9.3

20 Experimental Derived Visuals🔗

animate/experimental contains lower-level escape hatches. New scene dependencies should normally use relation-visual from animate, which declares its inputs and cacheability. A derived Visual remains useful when an author intentionally needs a pure arbitrary resolver over a sampled scene state.

procedure

(derived-visual template resolver)  derived-visual?

  template : visual?
  resolver : (-> derived-context? visual? visual?)
Creates an immutable Visual definition driven by a pure resolver. The concrete template supplies identity and ordinary affine placement. At each sample the resolver receives a read-only context and must return a non-derived Visual with the same identity. Direct animation of a derived Visual is not valid; animate the named values or ordinary inputs on which it depends.

procedure

(derived-visual? value)  boolean?

  value : any/c
Recognizes a derived Visual.

procedure

(derived-context? value)  boolean?

  value : any/c
Recognizes a derived resolver context.

procedure

(derived-context-value-has? context id)  boolean?

  context : derived-context?
  id : (or/c symbol? scene-parameter?)
Reports whether the sampled state has the requested named semantic value.

procedure

(derived-context-value-ref context id)  any/c

  context : derived-context?
  id : (or/c symbol? scene-parameter?)
Returns the requested named sampled value, raising an exception when absent.

procedure

(derived-context-visual-has? context id)  boolean?

  context : derived-context?
  id : (or/c symbol? visual-path?)
Reports whether a top-level or nested Visual path is present without forcing a derived dependency to resolve.

procedure

(derived-context-visual-ref context id)  visual?

  context : derived-context?
  id : (or/c symbol? visual-path?)
Resolves the requested Visual in the current sampled state. Nested values are returned in composed world coordinates. Cycles are rejected; successful results are memoized only within this one resolution traversal.

Limitation: a derived resolver is an arbitrary procedure, so it is memory-only for persistent caching unless its enclosing project supplies an explicit cache identity.