# Introduction

> An overview of Apricot, a 3D engine for Expo apps on iOS and Android, with its main ideas, packages and requirements.

Run it live in the playground: [Spinning cube](https://playground.matthiasbrandolin.dev/spinning-cube).

Apricot is a 3D engine for Expo apps on iOS and Android. You build a scene from React components, and Apricot renders it with WebGPU inside an app screen. In web browsers without WebGPU it draws with WebGL 2. Typical scenes are a product you can spin, coins that stack, fruit that falls over a screen and piles up, a car you can drive or open door by door, and a train running a line on a map.

```tsx title="SpinningCube.tsx" playground="spinning-cube"
import { Box, Scene, Spin } from "@apricotjs/react-native";

export function SpinningCube() {
  return (
    <Scene style={{ flex: 1 }}>
      <Spin speed={1}>
        <Box size={1.6} color="#ff9f59" />
      </Spin>
    </Scene>
  );
}
```

This is a complete scene. It draws a lit orange cube turning on a cream background. The default `look="soft"` adds the lights, and the camera looks at the origin from 6 units away.

> [!IMPORTANT]
> Apricot 0.1 has just been released. Breaking changes and other major changes can still happen between versions, so pin the version you use.

## What you can build

| Use | Examples | Guides |
| --- | --- | --- |
| Products | A card that catches the light, a car with opening doors and paint colours, a laptop whose lid follows your finger | [Models](https://matthiasbrandolin.dev/apricot/guides/models) |
| Overlays | Objects that drop over an existing screen and pile up, while the screen underneath stays usable | [Falling objects](https://matthiasbrandolin.dev/apricot/guides/falling-objects) |
| Small worlds | A toy car you drive, a metro line with a moving train, a cinema with 448 tappable seats | [Vehicles](https://matthiasbrandolin.dev/apricot/guides/vehicles), [Paths and labels](https://matthiasbrandolin.dev/apricot/guides/paths-and-labels), [Instances](https://matthiasbrandolin.dev/apricot/guides/instances) |
| Arranging things by hand | Furnishing a room, setting up a beach, arranging a desk. People tap to pick up, drag and twist to turn, with undo, redo and saved layouts. | [Placement](https://matthiasbrandolin.dev/apricot/guides/placement), [Ground and water](https://matthiasbrandolin.dev/apricot/guides/ground-and-water), [Lighting a room](https://matthiasbrandolin.dev/apricot/guides/rooms) |
| Effects | Confetti for a milestone, sparkles for a reward, smoke from a chimney, snow | [Particles](https://matthiasbrandolin.dev/apricot/guides/particles) |

## How it works

- `<Scene>` is a React Native view. Inside it you place shapes (`<Box>`, `<Sphere>`…), models (`<Model>`), lights, cameras and behaviors (`<Spin>`, `<Vehicle>`, `<Pile>`).
- Every animatable prop (`position`, `rotation`, `scale`, a light's `intensity`, a joint's value…) takes a plain value. With Reanimated installed, it also takes a shared value. Gestures and springs that write shared values move things without re-rendering React.
- A scene that doesn't change doesn't render (`frameloop="demand"`, the default).
- Lighting presets (`look`), a studio environment for reflections (`environment="studio"`) and 16 material presets (`"chrome"`, `"car-paint"`, `"glass"`…) give a lit scene with no setup.
- Each separate mesh is one draw call. Use `<Instances>` for many copies of one object, `<Merged>` to draw a piece made of many shapes as one mesh, and `<Bundle>` for parts of a scene that don't move.

## Packages

| Package | What it contains | Import from |
| --- | --- | --- |
| `@apricotjs/react-native` | `<Scene>`, shapes, lights and lamps, cameras, behaviors, instances, labels, paths, placement and layouts, ground and water, hooks, the Expo config plugin | `@apricotjs/react-native` |
| `@apricotjs/react-native/model` | `<Model>`, model kits, `useModel`, `useTexture`, downloads | `@apricotjs/react-native/model` |
| `@apricotjs/assets` | Ready-made objects: `MoneyStack`, `Coin`, `Apple`, `Peach`, `Car`, `Card`, `Trees`, `Ground`, `ContactShadow`, `Backdrop`, `StudioFloor` | `@apricotjs/assets` |
| `@apricotjs/core` | The engine without React, and utilities such as `seededRandom`, `Path` and `Trip` | `@apricotjs/core` |
| `@apricotjs/metro` | `withApricot()` for `metro.config.js`, and the `apricot-models` CLI that optimises and inspects `.glb` files | `@apricotjs/metro` |

## Requirements at a glance

- Expo SDK 57, the New Architecture, and a **development build** (Expo Go cannot load WebGPU).
- On the web: a browser with WebGPU or WebGL 2. See [On the web](https://matthiasbrandolin.dev/apricot/concepts/scenes#on-the-web).
- iOS, and Android 8.0 or later (`minSdkVersion` 26, set for you by the config plugin).
- Required peers: `react-native-webgpu` and `three` (r186). Optional, for the features that use them: `react-native-reanimated` 4 with `react-native-worklets` (shared values), `expo-asset` and `expo-file-system` (bundled models and textures, saved layouts).

Full steps: [Installation](https://matthiasbrandolin.dev/apricot/installation).

## Where to go next

1. [Installation](https://matthiasbrandolin.dev/apricot/installation): add Apricot to an Expo app.
2. [Quick start](https://matthiasbrandolin.dev/apricot/quick-start): build a first scene and make it interactive, step by step.
3. [Building with AI](https://matthiasbrandolin.dev/apricot/ai): the rules an AI assistant needs to write correct Apricot code. If you use one, give it [llms.txt](https://matthiasbrandolin.dev/apricot/llms.txt).
4. [Core concepts](https://matthiasbrandolin.dev/apricot/concepts/scenes): how scenes, units, animation and objects work.
5. [API reference](https://matthiasbrandolin.dev/apricot/reference/scene): every component, prop and default.
