Module: AnimateIt
- Defined in:
- lib/animate_it.rb,
lib/animate_it/beats.rb,
lib/animate_it/scene.rb,
lib/animate_it/style.rb,
lib/animate_it/units.rb,
lib/animate_it/easing.rb,
lib/animate_it/engine.rb,
lib/animate_it/errors.rb,
lib/animate_it/output.rb,
lib/animate_it/timing.rb,
lib/animate_it/runtime.rb,
lib/animate_it/version.rb,
lib/animate_it/registry.rb,
lib/animate_it/timeline.rb,
lib/animate_it/animation.rb,
lib/animate_it/composition.rb,
lib/animate_it/embed_helper.rb,
lib/animate_it/props_schema.rb,
lib/animate_it/render_store.rb,
lib/animate_it/text_effects.rb,
lib/animate_it/tracks/layer.rb,
lib/animate_it/verification.rb,
lib/animate_it/view_helpers.rb,
lib/animate_it/configuration.rb,
lib/animate_it/frame_context.rb,
lib/animate_it/asset_manifest.rb,
lib/animate_it/asset_renderer.rb,
lib/animate_it/frame_duration.rb,
lib/animate_it/video_renderer.rb,
app/jobs/animate_it/render_job.rb,
lib/animate_it/tracks/document.rb,
lib/animate_it/tracks/recorder.rb,
lib/animate_it/animation_helpers.rb,
app/jobs/animate_it/application_job.rb,
lib/animate_it/track_document_schema.rb,
app/controllers/animate_it/audio_controller.rb,
app/controllers/animate_it/props_controller.rb,
app/controllers/animate_it/frames_controller.rb,
app/controllers/animate_it/studio_controller.rb,
app/controllers/animate_it/renders_controller.rb,
app/controllers/animate_it/application_controller.rb,
lib/generators/animate_it/install/install_generator.rb,
app/controllers/animate_it/public_players_controller.rb
Overview
playwright is a development-only gem (deploy image runs bundle install --without development test). Defer loading until a render is actually
requested so production boot / asset precompile can load this file
without the gem present.
Defined Under Namespace
Modules: AnimationHelpers, AssetRenderer, Easing, EmbedHelper, Generators, Runtime, Style, TextEffects, Timing, TrackDocumentSchema, Tracks, Units, ViewHelpers Classes: AnimatableBuilder, AnimatableElement, AnimationProperty, AnimationSet, ApplicationController, ApplicationJob, AssetManifest, AudioController, Beat, Beats, Composition, CompositionNotFoundError, Configuration, Engine, Error, FrameContext, FrameDuration, FramesController, Output, OutputsBuilder, PropsController, PropsSchema, PublicPlayersController, Registry, RenderJob, RenderStore, RendersController, Scene, StudioController, Timeline, Verification, VideoRenderer
Constant Summary collapse
- VERSION =
"0.4.0".freeze
Class Method Summary collapse
- .compositions ⇒ Object
- .config ⇒ Object
- .configure {|config| ... } ⇒ Object
-
.load_compositions! ⇒ Object
Boot-time + dev-reload entry point.
- .registry ⇒ Object
-
.reload_compositions! ⇒ Object
Dev-reload alias — clears the registry so a renamed or deleted composition id doesn't linger, then re-loads everything.
- .reset! ⇒ Object
Class Method Details
.compositions ⇒ Object
52 53 54 |
# File 'lib/animate_it.rb', line 52 def compositions registry.all end |
.config ⇒ Object
40 41 42 |
# File 'lib/animate_it.rb', line 40 def config @config ||= Configuration.new end |
.configure {|config| ... } ⇒ Object
44 45 46 |
# File 'lib/animate_it.rb', line 44 def configure yield(config) end |
.load_compositions! ⇒ Object
Boot-time + dev-reload entry point. Wired by the engine's
to_prepare initializer, which fires once at boot and on every
autoloader reload after a watched file changes.
The host's app/videos is in config.autoload_paths (set by the
engine), so Zeitwerk owns the constants. On reload Zeitwerk has
already remove_const'd every composition by the time we run, so
eager_load_dir re-defines them fresh and the inherited hook
fires — guaranteeing a clean Timeline / @beats / @outputs per
reload (no stale segments accumulating across edits).
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/animate_it.rb', line 70 def load_compositions! return unless defined?(Rails) && Rails.respond_to?(:root) && Rails.root videos_dir = Rails.root.join("app/videos") return unless videos_dir.directory? if defined?(Rails.autoloaders) && Rails.autoloaders.main.respond_to?(:eager_load_dir) Rails.autoloaders.main.eager_load_dir(videos_dir.to_s) else # Fallback for environments without Zeitwerk eager_load_dir # (older Rails / non-Zeitwerk autoloaders). `load` re-runs the # file each time which is fine here because compositions are # idempotent re-openable classes. videos_dir.glob("**/*.rb").sort.each { |path| load(path.to_s) } end # After every composition class is loaded, give each one a chance # to auto-mount its single nested Scene class (the single-scene # shorthand). Idempotent: skips comps that already declared a # `scene`/`series`/`audio`. compositions.each(&:auto_mount_single_scene!) end |
.registry ⇒ Object
48 49 50 |
# File 'lib/animate_it.rb', line 48 def registry @registry ||= Registry.new end |
.reload_compositions! ⇒ Object
Dev-reload alias — clears the registry so a renamed or deleted composition id doesn't linger, then re-loads everything.
95 96 97 98 |
# File 'lib/animate_it.rb', line 95 def reload_compositions! registry.reset! load_compositions! end |