scenic_new v0.10.0 mix scenic.new.example

Generates a starter Scenic application.

This is the easiest way to set up a new Scenic project.

Install scenic.new

mix archive.install hex scenic_new

Build the Starter Application

First, navigate the command-line to the directory where you want to create your new Scenic application. Then run the following commands: (change my_app to the name of your application)

mix scenic.new my_app
cd my_app
mix do deps.get, scenic.run

Running and Debugging

Once the application and its dependencies are set up, there are two main ways to run it.

If you want to run your application under IEx so that you can debug it, simply run

iex -S mix

This works just like any other Elixir application.

If you want to run your application outside of IEx, you should start it like this:

mix scenic.run

The Starter Application

The starter application created by the generator above shows the basics of building a Scenic application. It has four scenes, two components, and a simulated sensor.

SceneDescription
SplashThe Splash scene is configured to run when the application is started in the config/config.exs file. It runs a simple animation, then transitions to the Sensor scene. It also shows how intercept basic user input to exit the scene early.
SensorThe Sensor scene depicts a simulated temperature sensor. The sensor is always running and updates it's data through the Scenic.SensorPubSub server.
Sensor specThe Sensor scene implemendted using specs
PrimitivesThe Primitives scenes displays an overview of the basic primitive types and some of the styles that can be applied to them.
ComponentsThe Components scene shows the basic components that come with Scenic. The crash button will cause a match error that will crash the scene, showing how the supervision tree restarts the scene. It also shows how to receive events from components.
ComponentDescription
NavThe navigation bar at the top of the main scenes shows how to navigate between scenes and how to construct a simple component and pass a parameter to it. Note that it references a clock, creating a nested component. The clock is positioned by dynamically querying the width of the ViewPort
NotesThe notes section at the bottom of each scene is very simple and also shows passing in custom data from the parent.

The simulated temperature sensor doesn't collect any actual data, but does show how you would set up a real sensor and publish data from it into the Scenic.SensorPubSub service.

Next, you should read guides describing the overall Scenic structure. This is in the documentation for Scenic itself

Link to this section Summary

Functions

A task needs to implement run which receives a list of command line args

Link to this section Functions

A task needs to implement run which receives a list of command line args.

Callback implementation for Mix.Task.run/1.