Bouncing Ball Example

This directory contains an example application which draws an animated bouncing ball using Scenic.

Source layout

  • main.cc: Main entrypoint for the component binary

Before you begin

  1. Start a FEMU instance:

    $ ./third_party/fuchsia-sdk/bin/femu.sh --image workstation.qemu-x64-release -N
    
  2. Start a local package repository instance:

    $ ./third_party/fuchsia-sdk/tools/x64/fserve --image workstation.qemu-x64-release
    

Note: This sample requires an image configuration that supports graphical sessions, such as workstation.

Build the sample

  1. Run the build script to compile and package the sample:

    $ ./scripts/build.sh
    
  2. Publish the FAR package to your local package repository:

    $ ./third_party/fuchsia-sdk/tools/x64/fpublish out/x64/bouncing_ball.far
    

Run the sample

  1. Launch the sample component using ffx session add. This resolves the component from the package repository and adds it to the session manager:

    $ ffx session add fuchsia-pkg://fuchsia.com/bouncing_ball#meta/bouncing_ball.cm
    
  2. Verify that you can see the bouncing ball animation on your display.

  3. If you have an input device attached, click the button to restart the animation.