This class offers a fluent, extensible and strongly typed DSL for creating Eligius configurations.
Example
Building a configuration using the factory
To initialize a basic configuration to start off of:
constfactory = newConfigurationFactory() .init("en-US") // Define the default language .addLanguage("en-US", "English") // Add English as a supported language .addLanguage("nl-NL", "Nederlands") // Add Dutch as a supported language .setLayoutTemplate("<div class=\"main.container\"></div>") // Add the main container for the presentation .setContainerSelector("#ct-container") // Selector for the element in the body that will contain the presentation .addTimeline( // Add a first timeline 'timeline-1', // Give it a name "animation", // This is RAF based timeline 200, // The duration of the timeline in seconds false, // The presentation does NOT play in a loop ".timeline-container"// The element within the main layout (defined by the layoutTemplate) in which the timeline will be rendered ) .editTimelineProviderSettings() // Add a timeline provider .addProvider("animation") // One that provides timelines for type 'animation' .setSystemName("RequestAnimationFrameTimelineProvider") // The system name of the provider .setVendor("eligius") // Eligius is the vendor in this case .end(); // This finally returns the ConfigurationFactory instance
The ConfigurationFactory can also be used to edit an existing configuration. In this case, simply
pass the JSON configuration to the ConfigurationFactory's constructor:
This class offers a fluent, extensible and strongly typed DSL for creating Eligius configurations.
Example
Building a configuration using the factory To initialize a basic configuration to start off of:
Then to add an init action:
After that, add a timeline action:
It also possible to extend the factory with specialized creation methods for the particular configuration you are building:
Finally, retrieve the configuration and save it:
The
ConfigurationFactory
can also be used to edit an existing configuration. In this case, simply pass the JSON configuration to theConfigurationFactory
's constructor: