Easy animation system focused on code.
Example
start by creating a new rust app and import 3 crates:
# /Cargol.toml
[]
# contains functions and types for defining animations
# that will be sent to the scal-runtime for rendering/preview.
= "..."
# used for communicating with the scal runtime. you only use ``#[scal_ipc::main]`` from it
= "..."
# `glam` is a simple and fast linear algebra library for games and graphics.
= "0.33.2"
define the animation with:
/// /src/main.rs
use ;
use *;
// Size of the virtual canvas not the output resolution - configured by Config.toml
const WINDOW: Vec2 = vec2;
// This handles all the ipc communication with the scal runtime
Basic animation output config.
# /Config.toml
[]
= "cargo run"
[]
= 2.0
= 3840
= 2160
= 60
[]
= "test.mov"
= "H264Nvenc"
make sure that you have installed required system dependencies:
-
Ubuntu/Debian:
sudo apt install ffmpeg libwayland-dev libxkbcommon-dev libx11-dev libxcursor-dev libxi-dev libxrandr-dev libxcb1-dev libasound2-dev libpulse-dev -
Arch:
sudo pacman -S ffmpeg wayland libxkbcommon libx11 libxcursor libxi libxrandr libxcb alsa-lib libpulse -
Fedora:
sudo dnf install ffmpeg-devel wayland-devel libxkbcommon-devel libX11-devel libXcursor-devel libXi-devel libXrandr-devel libxcb-devel alsa-lib-devel pulseaudio-libs-devel -
NixOS: download flake file:
Set-up the environment:
And now you can just use the scal runtime to render/preview the animation.
Features
High Quality Animations of Code with Ease.
First party support for code modification animations, syntax highlighting, custom color schemes, and glyphs. Supports syntax highlighting for most popular languages using Tree-sitter. Use standard Base16 color schemes to configure syntax highlighting.
Hot Reloading Animation Preview
Supports preview view with a timeline that automatically reloads upon animation code change. Audio waveform display support in timeline. You can click on individual animation operations or sound fx to display what type of animation they are, and where they are located in the animation source code.
LSP
Thanks to the powerful rust LSP you can read documentation from your editor.
Examples
If you want to see features of this project you can look at the example directory.
Clear Syntax
you instantly know what every function does.
let typing = sfx
.path
.volume
.pitch
.skip_time
.duration
.pitch_variation;
Fast Render Times
Using FFmpeg supports hardware H264 encoding for most popular GPU brands- nvidia, intel, apple(I only have nvidia gpu-s so tests on other platforms are needed) Uses WGPU to efficiently render scenes.
Multi-platform
Works on all platforms(Linux, Mac, Windows) (I only have NixOS systems so testing on other platforms is needed)
Audio System
Uses FFmpeg for audio encoding and cpal for preview audio, to deliver stable audio system.
Installing Scala Runtime
Distro Package
Sadly there are no packages currently for this app, you need to compile it from source or install using cargo.
Nix Flake
You can automatically compile from source using flakes like this:
{
inputs.scal-runtime = {
url = "github:Feeflak/scal";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, scal-runtime, ... }: {
nixosConfigurations.my-pc = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, ... }: {
environment.systemPackages = [
scal-runtime.packages.${pkgs.stdenv.hostPlatform.system}.default
];
})
];
};
};
}
Compiling From Source
SCAL uses Cargo to manage all Rust dependencies automatically. Only a few native libraries must be installed manually.
1. Install Rust
If you don't already have Rust installed:
|
Verify the installation:
Linux
Arch Linux
Install the required packages:
Fedora
Install the required packages:
Debian / Ubuntu
Install the required packages:
NixOS
The repository already contains a development shell.
Enter it with:
or
All required libraries are provided automatically.
macOS
Install Homebrew if necessary.
Then install the required packages:
The remaining libraries required by SCAL are provided by macOS.
Windows
Install:
- Rust (via rustup)
- Visual Studio 2022 with the Desktop development with C++ workload
- LLVM/Clang
- FFmpeg
Using Winget:
winget install Rustlang.Rustup
winget install LLVM.LLVM
winget install Gyan.FFmpeg
After installing Visual Studio Build Tools, restart your terminal.
Building SCAL
Setting up a new animation project
- Init project
- Add dependencies to Cargo.toml
= "<version>"
= "<version>"
= "0.33.2"
- basic animation output config
# /Config.toml
[]
= "cargo run"
[]
= 2.0
= 3840
= 2160
= 60
[]
= "test.mov"
= "H264Nvenc"
- setup the ipc macro
// /scr/main.rs
#[scal_ipc::main]
fn main() -> Project {
todo!()
}
That's it, you can start writing any animation you want simple example:
// /scr/main.rs
use Vec2;
use *;
After Implementing New Features
- format everything with
cargo fmt - use clippy
cargo clippy --workspace --all-targets -- -W clippy::pedantic - run tests
cargo test.