On this page:
animate-project
animate-project?
module-binding-source
module-binding-source?
scene-source
scene-source?
timeline-source
timeline-source?
scene-program-source
scene-program-source?
render-spec
render-spec?
preview-spec
preview-spec?
output-spec
output-spec?
encoder-spec
encoder-spec?
cache-spec
cache-spec?
project-asset
project-asset?
project-target-section
project-target-all
project-target?
plan-project
project-plan?
prepare-project!
prepared-project?
project-plan->datum
9.3

13 Projects and Final Rendering🔗

An animate-project? is the one immutable declaration shared by final rendering and project preview. It separates a pure configuration plan from effectful preparation and execution.

procedure

(animate-project #:id id    
  #:source source    
  [#:render render    
  #:preview preview    
  #:output output    
  #:encoder encoder    
  #:cache cache    
  #:assets assets    
  #:metadata metadata])  animate-project?
  id : symbol?
  source : 
(or/c module-binding-source? scene-source?
       timeline-source? scene-program-source?)
  render : render-spec? = (render-spec)
  preview : preview-spec? = (preview-spec)
  output : output-spec? = (output-spec)
  encoder : encoder-spec? = (encoder-spec)
  cache : cache-spec? = (cache-spec)
  assets : (listof project-asset?) = '()
  metadata : hash? = #hasheq()
Creates one immutable project declaration. The constructor snapshots lists and hashes, so later caller mutation cannot change the project.

procedure

(animate-project? value)  boolean?

  value : any/c
Recognizes an immutable project declaration.

procedure

(module-binding-source module-path binding)

  module-binding-source?
  module-path : path-string?
  binding : symbol?
Declares a reloadable source suited to project workers and persistent caches.

procedure

(module-binding-source? value)  boolean?

  value : any/c
Recognizes a reloadable module binding source.

procedure

(scene-source scene)  scene-source?

  scene : scene?
Declares an in-memory Scene source for local planning and preview.

procedure

(scene-source? value)  boolean?

  value : any/c
Recognizes a direct Scene source.

procedure

(timeline-source timeline)  timeline-source?

  timeline : authored-timeline?
Declares an in-memory authored timeline source.

procedure

(timeline-source? value)  boolean?

  value : any/c
Recognizes a direct timeline source.

procedure

(scene-program-source program)  scene-program-source?

  program : scene-program?
Declares an in-memory source-program source.

procedure

(scene-program-source? value)  boolean?

  value : any/c
Recognizes a direct source-program source.

procedure

(render-spec [#:fps fps    
  #:width width    
  #:height height    
  #:renderer3d renderer3d    
  #:supersample supersample    
  #:workers workers])  render-spec?
  fps : exact-positive-integer? = 30
  width : exact-positive-integer? = 1280
  height : exact-positive-integer? = 720
  renderer3d : any/c = 'software
  supersample : exact-positive-integer? = 1
  workers : exact-positive-integer? = 1
Describes final raster quality. Renderer and camera fields have defaults too; see render-spec in the contract reference for the complete set. #:renderer3d is 'software by default. Passing an explicit opengl-renderer3d-spec selects the optional Racket/OpenGL backend for final project rendering; it requires Racket 9.3 gracket and #:workers 1. OpenGL is not loaded merely by constructing this immutable project declaration. }

procedure

(render-spec? value)  boolean?

  value : any/c
Recognizes a final-render configuration.

procedure

(preview-spec [#:fps fps 
  #:pixel-scale pixel-scale 
  #:cache-megabytes cache-megabytes 
  #:prefetch prefetch 
  #:audio? audio?]) 
  preview-spec?
  fps : exact-positive-integer? = 30
  pixel-scale : positive? = 1
  cache-megabytes : exact-nonnegative-integer? = 128
  prefetch : exact-nonnegative-integer? = 3
  audio? : boolean? = #f
Describes preview quality, bitmap-cache budget, and optional audio monitoring.

procedure

(preview-spec? value)  boolean?

  value : any/c
Recognizes a preview configuration.

procedure

(output-spec [#:root root 
  #:name name 
  #:format format 
  #:overwrite-policy overwrite-policy]) 
  output-spec?
  root : path-string? = "media"
  name : string? = "animation"
  format : (or/c 'mp4 'png-sequence) = 'mp4
  overwrite-policy : (or/c 'error 'replace) = 'error
Declares final artifact naming. Planning determines exact artifact paths without creating their parent directories.

procedure

(output-spec? value)  boolean?

  value : any/c
Recognizes an output declaration.

procedure

(encoder-spec [#:codec codec    
  #:pixel-format pixel-format    
  #:options options    
  #:audio-codec audio-codec    
  #:audio-options audio-options    
  #:fast-start? fast-start?])  encoder-spec?
  codec : symbol? = 'h264
  pixel-format : symbol? = 'yuv420p
  options : hash? = #hasheq()
  audio-codec : symbol? = 'aac
  audio-options : hash? = #hasheq()
  fast-start? : boolean? = #t
Declares video and audio encoder settings independently of frame rendering.

procedure

(encoder-spec? value)  boolean?

  value : any/c
Recognizes a video/audio encoder declaration.

procedure

(cache-spec [#:root root    
  #:policy policy    
  #:max-bytes max-bytes    
  #:domains domains])  cache-spec?
  root : path-string? = ".animate-cache"
  policy : symbol? = 'read-write
  max-bytes : exact-nonnegative-integer? = (* 1024 1024 1024)
  domains : (listof symbol?)
   = '(formula frames segments audio waveform source-program)
Declares domain-specific cache policy. Encoder settings affect segment caches, not frame caches; audio changes do not invalidate visual frames.

procedure

(cache-spec? value)  boolean?

  value : any/c
Recognizes a cache declaration.

procedure

(project-asset path    
  [#:role role    
  #:metadata metadata])  project-asset?
  path : path-string?
  role : symbol? = 'visual
  metadata : hash? = #hasheq()
Declares a visual, audio, formula, or author-defined asset.

procedure

(project-asset? value)  boolean?

  value : any/c
Recognizes a declared project asset.

procedure

(project-target-section name)  project-target?

  name : symbol?
Selects one authored section.
Selects the complete declared source.

procedure

(project-target? value)  boolean?

  value : any/c
Recognizes a project target.

procedure

(plan-project project    
  [#:target target    
  #:directory directory])  project-plan?
  project : animate-project?
  target : project-target? = (project-target-all)
  directory : path-string? = (current-directory)
Normalizes the declaration and produces exact output/cache paths without reading source files, locating tools, creating directories, or rendering.

procedure

(project-plan? value)  boolean?

  value : any/c
Recognizes an immutable pure project plan.

procedure

(prepare-project! plan)  prepared-project?

  plan : project-plan?
Loads the declared source, validates its type and selected target, fingerprints inputs/tools, and determines frame indices. Preparation may read files and tools but does not render frames or create final artifacts.

procedure

(prepared-project? value)  boolean?

  value : any/c
Recognizes an effectfully prepared but unrendered project.

procedure

(project-plan->datum plan)  immutable-hash?

  plan : project-plan?
Returns a serializable inspection representation of a pure plan.

Use execute-prepared-project! from animate/render to run a prepared plan. It produces an immutable execution report after frame rendering, encoding, and optional media assembly, and installs final artifacts atomically.

Limitation: direct Scene, timeline, and program sources may contain arbitrary procedures. They are valid for an in-memory session but cannot have an honest persistent fingerprint unless the author supplies an explicit key.