Compare commits
7 Commits
1d2f617a4e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a8943fc924 | |||
| 1d9c38e94a | |||
| fa3f7a8403 | |||
| 1d9508f49b | |||
| 6d2ffe6902 | |||
| c352ba7fd3 | |||
| 95087124b5 |
5
.github/workflows/publish.yml
vendored
5
.github/workflows/publish.yml
vendored
@@ -32,11 +32,16 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
|
||||
- name: setup .npmrc
|
||||
run: mv .npmrc.githubactions .npmrc
|
||||
- name: install frontend dependencies
|
||||
run: yarn install # change this to npm or pnpm depending on which one you use
|
||||
env:
|
||||
UNOM_PACKAGES_TOKEN: ${{ secrets.UNOM_PACKAGES_TOKEN }}
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
UNOM_PACKAGES_TOKEN: ${{ secrets.UNOM_PACKAGES_TOKEN }}
|
||||
with:
|
||||
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version
|
||||
releaseName: "App v__VERSION__"
|
||||
|
||||
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
@@ -27,8 +27,13 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
|
||||
- name: setup .npmrc
|
||||
run: mv .npmrc.githubactions .npmrc
|
||||
- name: install frontend dependencies
|
||||
run: yarn install # change this to npm or pnpm depending on which one you use
|
||||
env:
|
||||
UNOM_PACKAGES_TOKEN: ${{ secrets.UNOM_PACKAGES_TOKEN }}
|
||||
- uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
UNOM_PACKAGES_TOKEN: ${{ secrets.UNOM_PACKAGES_TOKEN }}
|
||||
|
||||
4
app/.npmrc.githubactions
Normal file
4
app/.npmrc.githubactions
Normal file
@@ -0,0 +1,4 @@
|
||||
//packages.unom.io/:_authToken=${UNOM_PACKAGES_TOKEN}
|
||||
registry=https://registry.npmjs.org/
|
||||
@tempblade:registry=https://packages.unom.io
|
||||
@unom:registry=https://packages.unom.io
|
||||
@@ -22,6 +22,7 @@
|
||||
"@radix-ui/react-toolbar": "^1.0.3",
|
||||
"@tauri-apps/api": "^1.3.0",
|
||||
"@tempblade/common": "^2.0.1",
|
||||
"@types/d3-array": "^3.0.5",
|
||||
"@types/lodash.set": "^4.3.7",
|
||||
"@unom/style": "^0.2.14",
|
||||
"@visx/axis": "^3.1.0",
|
||||
|
||||
98
app/src-tauri/Cargo.lock
generated
98
app/src-tauri/Cargo.lock
generated
@@ -418,6 +418,20 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "creator_rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"font-kit",
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"simple-easing",
|
||||
"tauri",
|
||||
"uuid",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.8"
|
||||
@@ -441,14 +455,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.14"
|
||||
version = "0.9.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695"
|
||||
checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
"memoffset",
|
||||
"memoffset 0.9.0",
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
@@ -645,9 +659,9 @@ checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b"
|
||||
|
||||
[[package]]
|
||||
name = "dlib"
|
||||
version = "0.5.0"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac1b7517328c04c2aa68422fc60a41b92208182142ed04a25879c26c8f878794"
|
||||
checksum = "330c60081dcc4c72131f8eb70510f1ac07223e5d4163db481a04a0befcffa412"
|
||||
dependencies = [
|
||||
"libloading",
|
||||
]
|
||||
@@ -764,7 +778,7 @@ version = "0.3.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a3cf3a800ff6e860c863ca6d4b16fd999db8b752819c1606884047b73e468535"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"memoffset 0.8.0",
|
||||
"rustc_version 0.4.0",
|
||||
]
|
||||
|
||||
@@ -1081,8 +1095,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"libc",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1547,12 +1563,12 @@ checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
|
||||
|
||||
[[package]]
|
||||
name = "libloading"
|
||||
version = "0.7.4"
|
||||
version = "0.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f"
|
||||
checksum = "d580318f95776505201b28cf98eb1fa5e4be3b689633ba6a3e6cd880ff22d8cb"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"winapi",
|
||||
"windows-sys 0.48.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1694,6 +1710,15 @@ dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miniz_oxide"
|
||||
version = "0.7.1"
|
||||
@@ -1966,9 +1991,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
|
||||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "2.6.0"
|
||||
version = "2.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e68e84bfb01f0507134eac1e9b410a12ba379d064eab48c50ba4ce329a527b70"
|
||||
checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"ucd-trie",
|
||||
@@ -2570,11 +2595,11 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "2.3.3"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe"
|
||||
checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513"
|
||||
dependencies = [
|
||||
"base64 0.13.1",
|
||||
"base64 0.21.0",
|
||||
"chrono",
|
||||
"hex",
|
||||
"indexmap",
|
||||
@@ -2586,9 +2611,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "2.3.3"
|
||||
version = "3.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f"
|
||||
checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
@@ -2881,9 +2906,9 @@ checksum = "fd1ba337640d60c3e96bc6f0638a939b9c9a7f2c316a1598c279828b3d1dc8c5"
|
||||
|
||||
[[package]]
|
||||
name = "tauri"
|
||||
version = "1.3.0"
|
||||
version = "1.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d42ba3a2e8556722f31336a0750c10dbb6a81396a1c452977f515da83f69f842"
|
||||
checksum = "7fbe522898e35407a8e60dc3870f7579fea2fc262a6a6072eccdd37ae1e1d91e"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cocoa",
|
||||
@@ -2929,9 +2954,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-build"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "929b3bd1248afc07b63e33a6a53c3f82c32d0b0a5e216e4530e94c467e019389"
|
||||
checksum = "7d2edd6a259b5591c8efdeb9d5702cb53515b82a6affebd55c7fd6d3a27b7d1b"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cargo_toml",
|
||||
@@ -2942,14 +2967,13 @@ dependencies = [
|
||||
"serde_json",
|
||||
"tauri-utils",
|
||||
"tauri-winres",
|
||||
"winnow",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tauri-codegen"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5a2105f807c6f50b2fa2ce5abd62ef207bc6f14c9fcc6b8caec437f6fb13bde"
|
||||
checksum = "54ad2d49fdeab4a08717f5b49a163bdc72efc3b1950b6758245fcde79b645e1a"
|
||||
dependencies = [
|
||||
"base64 0.21.0",
|
||||
"brotli",
|
||||
@@ -2973,9 +2997,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-macros"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8784cfe6f5444097e93c69107d1ac5e8f13d02850efa8d8f2a40fe79674cef46"
|
||||
checksum = "8eb12a2454e747896929338d93b0642144bb51e0dddbb36e579035731f0d76b7"
|
||||
dependencies = [
|
||||
"heck 0.4.1",
|
||||
"proc-macro2",
|
||||
@@ -2987,9 +3011,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime"
|
||||
version = "0.13.0"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3b80ea3fcd5fefb60739a3b577b277e8fc30434538a2f5bba82ad7d4368c422"
|
||||
checksum = "108683199cb18f96d2d4134187bb789964143c845d2d154848dda209191fd769"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"http",
|
||||
@@ -3008,9 +3032,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-runtime-wry"
|
||||
version = "0.13.0"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d1c396950b1ba06aee1b4ffe6c7cd305ff433ca0e30acbc5fa1a2f92a4ce70f1"
|
||||
checksum = "0b7aa256a1407a3a091b5d843eccc1a5042289baf0a43d1179d9f0fcfea37c1b"
|
||||
dependencies = [
|
||||
"cocoa",
|
||||
"gtk",
|
||||
@@ -3028,12 +3052,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "tauri-utils"
|
||||
version = "1.3.0"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a6f9c2dafef5cbcf52926af57ce9561bd33bb41d7394f8bb849c0330260d864"
|
||||
checksum = "03fc02bb6072bb397e1d473c6f76c953cda48b4a2d0cce605df284aa74a12e84"
|
||||
dependencies = [
|
||||
"brotli",
|
||||
"ctor",
|
||||
"dunce",
|
||||
"glob",
|
||||
"heck 0.4.1",
|
||||
"html5ever",
|
||||
@@ -3068,16 +3093,13 @@ dependencies = [
|
||||
name = "tempblade-creator-app"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"font-kit",
|
||||
"creator_rs",
|
||||
"logging_timer",
|
||||
"rayon",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"simple-easing",
|
||||
"tauri",
|
||||
"tauri-build",
|
||||
"tint",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3382,15 +3404,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "345444e32442451b267fc254ae85a209c64be56d2890e601a0c37ff0c3c5ecd2"
|
||||
dependencies = [
|
||||
"getrandom 0.2.9",
|
||||
"rand 0.8.5",
|
||||
"uuid-macro-internal",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "uuid-macro-internal"
|
||||
version = "1.3.3"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f67b459f42af2e6e1ee213cb9da4dbd022d3320788c3fb3e1b893093f1e45da"
|
||||
checksum = "8614dda80b9075fbca36bc31b58d1447715b1236af98dee21db521c47a0cc2c0"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -10,20 +10,20 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "1.3", features = [] }
|
||||
tauri-build = { version = "1.4", features = [] }
|
||||
|
||||
|
||||
[dependencies]
|
||||
|
||||
uuid = { version = "1.3.3", features = ["v4", "fast-rng", "macro-diagnostics"] }
|
||||
tauri = { version = "1.3", features = ["dialog-open", "dialog-save", "shell-open"] }
|
||||
creator_core = { path = "../../lib/creator_rs", features = [
|
||||
"fonts",
|
||||
"parallelization",
|
||||
"tauri",
|
||||
], version = "*", package = "creator_rs" }
|
||||
tauri = { version = "1.4", features = ["dialog-open", "dialog-save", "shell-open"] }
|
||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||
serde_json = "1.0"
|
||||
tint = "1.0.0"
|
||||
simple-easing = "1.0.1"
|
||||
logging_timer = "1.1.0"
|
||||
rayon = "1.7"
|
||||
font-kit = "0.11.0"
|
||||
|
||||
[features]
|
||||
# this feature is used for production builds or when `devPath` points to the filesystem
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use crate::{
|
||||
use creator_core::{
|
||||
__cmd__calculate_timeline_at_curr_frame, __cmd__get_system_families, __cmd__get_system_font,
|
||||
__cmd__get_system_fonts, __cmd__get_values_at_frame_range_from_animated_float,
|
||||
__cmd__get_values_at_frame_range_from_animated_float_vec2,
|
||||
__cmd__get_values_at_frame_range_from_animated_float_vec3,
|
||||
animation::{
|
||||
primitives::values::{
|
||||
primitives::values::animated_values::{
|
||||
get_values_at_frame_range_from_animated_float,
|
||||
get_values_at_frame_range_from_animated_float_vec2,
|
||||
get_values_at_frame_range_from_animated_float_vec3,
|
||||
},
|
||||
timeline::calculate_timeline_entities_at_frame,
|
||||
timeline::calculate_timeline_at_curr_frame,
|
||||
},
|
||||
fonts::{get_system_families, get_system_font, get_system_fonts},
|
||||
fonts::fonts::{get_system_families, get_system_font, get_system_fonts},
|
||||
};
|
||||
|
||||
pub mod animation;
|
||||
pub mod fonts;
|
||||
|
||||
fn main() {
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
calculate_timeline_entities_at_frame,
|
||||
calculate_timeline_at_curr_frame,
|
||||
get_system_font,
|
||||
get_system_families,
|
||||
get_system_fonts,
|
||||
|
||||
@@ -90,7 +90,7 @@ export class Drawer {
|
||||
|
||||
const parsedAnimatedEntities = AnimatedEntities.parse(animatedEntities);
|
||||
|
||||
const data = await invoke("calculate_timeline_entities_at_frame", {
|
||||
const data = await invoke("calculate_timeline_at_curr_frame", {
|
||||
timeline: {
|
||||
entities: parsedAnimatedEntities,
|
||||
render_state: renderState,
|
||||
|
||||
32
app/src/services/render.service.ts
Normal file
32
app/src/services/render.service.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Timeline } from "primitives/Timeline";
|
||||
// TODO: publish package maybe provide wrapper etc.
|
||||
import * as creatorWasm from "../../../lib/creator_rs/pkg";
|
||||
import { z } from "zod";
|
||||
import { useTimelineStore } from "stores/timeline.store";
|
||||
import { useEntitiesStore } from "stores/entities.store";
|
||||
import { useRenderStateStore } from "stores/render-state.store";
|
||||
|
||||
export class RenderService {
|
||||
render() {
|
||||
|
||||
}
|
||||
|
||||
calculate() {
|
||||
const timelineStore = useTimelineStore.getState();
|
||||
const entitiesStore = useEntitiesStore.getState();
|
||||
const renderStateStore = useRenderStateStore.getState();
|
||||
|
||||
|
||||
let timeline: z.input<typeof Timeline> = {
|
||||
...timelineStore,
|
||||
entities: entitiesStore.entities,
|
||||
render_state: renderStateStore.renderState
|
||||
}
|
||||
|
||||
timeline = Timeline.parse(timeline);
|
||||
|
||||
const renderedEntities = creatorWasm.calculate_timeline_from_json_at_curr_frame(JSON.stringify(timeline));
|
||||
|
||||
console.log(renderedEntities);
|
||||
}
|
||||
}
|
||||
@@ -971,6 +971,11 @@
|
||||
resolved "https://packages.unom.io/@tempblade%2fcommon/-/common-2.0.1.tgz"
|
||||
integrity sha512-8uCqsfu2tcQq4O4XODS7Hn7Mj9hZh+Rh+Y0Fsej9Bbemn/WwlIT0WrUSzWGMZLcTspvgl6kz/ljBzCqLAa3Yyw==
|
||||
|
||||
"@types/d3-array@^3.0.5":
|
||||
version "3.0.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-3.0.5.tgz#857c1afffd3f51319bbc5b301956aca68acaa7b8"
|
||||
integrity sha512-Qk7fpJ6qFp+26VeQ47WY0mkwXaiq8+76RJcncDEfMc2ocRzXLO67bLFRNI4OX1aGBoPzsM5Y2T+/m1pldOgD+A==
|
||||
|
||||
"@types/d3-color@*":
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/d3-color/-/d3-color-3.1.0.tgz#6594da178ded6c7c3842f3cc0ac84b156f12f2d4"
|
||||
|
||||
1
lib/creator_rs/.gitignore
vendored
Normal file
1
lib/creator_rs/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
target
|
||||
3834
lib/creator_rs/Cargo.lock
generated
Normal file
3834
lib/creator_rs/Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
31
lib/creator_rs/Cargo.toml
Normal file
31
lib/creator_rs/Cargo.toml
Normal file
@@ -0,0 +1,31 @@
|
||||
[package]
|
||||
name = "creator_rs"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
authors = ["Enrico Bühler <buehler@unom.io>"]
|
||||
description = "Motion Design toolkit with spring, eased and linear based value interpolation, timeline functionality and more"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/tempblade/creator"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib", "lib"]
|
||||
|
||||
[dependencies]
|
||||
rayon = { version = "1.7", optional = true }
|
||||
font-kit = { version = "0.11", optional = true }
|
||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||
serde_json = "1.0"
|
||||
simple-easing = "1.0"
|
||||
tauri = { version = "1.4", optional = true, features = [
|
||||
"dialog-open",
|
||||
"dialog-save",
|
||||
"shell-open",
|
||||
] }
|
||||
uuid = { version = "1.3", features = ["v4", "macro-diagnostics", "js"] }
|
||||
wasm-bindgen = "0.2"
|
||||
|
||||
|
||||
[features]
|
||||
tauri = ["dep:tauri"]
|
||||
parallelization = ["dep:rayon"]
|
||||
fonts = ["dep:font-kit"]
|
||||
@@ -4,7 +4,7 @@ use crate::animation::{
|
||||
primitives::{
|
||||
paint::Paint,
|
||||
transform::{AnimatedTransform, Transform},
|
||||
values::{AnimatedFloatVec2, AnimatedValue},
|
||||
values::animated_values::{AnimatedFloatVec2, AnimatedValue},
|
||||
},
|
||||
timeline::Timeline,
|
||||
};
|
||||
@@ -4,7 +4,7 @@ use crate::animation::{
|
||||
primitives::{
|
||||
paint::Paint,
|
||||
transform::{AnimatedTransform, Transform},
|
||||
values::{AnimatedFloatVec2, AnimatedValue},
|
||||
values::animated_values::{AnimatedFloatVec2, AnimatedValue},
|
||||
},
|
||||
timeline::Timeline,
|
||||
};
|
||||
@@ -3,7 +3,7 @@ use crate::animation::{
|
||||
primitives::{
|
||||
paint::TextPaint,
|
||||
transform::{AnimatedTransform, Transform},
|
||||
values::{AnimatedFloatVec2, AnimatedValue},
|
||||
values::animated_values::{AnimatedFloatVec2, AnimatedValue},
|
||||
},
|
||||
timeline::Timeline,
|
||||
};
|
||||
@@ -2,7 +2,7 @@ use crate::animation::{
|
||||
primitives::{
|
||||
paint::TextPaint,
|
||||
transform::{AnimatedTransform, Transform},
|
||||
values::{AnimatedFloatVec2, AnimatedValue},
|
||||
values::animated_values::{AnimatedFloatVec2, AnimatedValue},
|
||||
},
|
||||
timeline::Timeline,
|
||||
};
|
||||
@@ -6,11 +6,12 @@ use super::{
|
||||
entities::common::AnimationData,
|
||||
interpolations::{interpolate_rendered_keyframes, InterpolationType},
|
||||
utils::render_keyframe,
|
||||
values::values::Float,
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Keyframe {
|
||||
pub value: f32,
|
||||
pub value: Float,
|
||||
pub offset: f32,
|
||||
pub id: Arc<str>,
|
||||
pub interpolation: Option<InterpolationType>,
|
||||
@@ -1,6 +1,6 @@
|
||||
use super::{
|
||||
entities::common::AnimationData,
|
||||
values::{AnimatedFloatVec2, AnimatedFloatVec3, AnimatedValue},
|
||||
values::animated_values::{AnimatedFloatVec2, AnimatedFloatVec3, AnimatedValue},
|
||||
};
|
||||
use crate::animation::timeline::Timeline;
|
||||
use serde::{Deserialize, Serialize};
|
||||
@@ -1,11 +1,14 @@
|
||||
use super::{
|
||||
use crate::animation::primitives::{
|
||||
entities::common::AnimationData,
|
||||
keyframe::{Keyframe, Keyframes},
|
||||
};
|
||||
#[cfg(feature = "parallelization")]
|
||||
use rayon::prelude::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::values::{Float, FloatVec2, FloatVec3};
|
||||
|
||||
pub trait AnimatedValue<T> {
|
||||
fn sort_keyframes(&mut self);
|
||||
fn get_value_at_frame(&self, curr_frame: i32, animation_data: &AnimationData, fps: i16) -> T;
|
||||
@@ -32,36 +35,36 @@ pub struct AnimatedFloatVec3 {
|
||||
pub keyframes: (AnimatedFloat, AnimatedFloat, AnimatedFloat),
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[cfg_attr(feature = "tauri", tauri::command)]
|
||||
pub fn get_values_at_frame_range_from_animated_float(
|
||||
animated_value: AnimatedFloat,
|
||||
start_frame: i32,
|
||||
end_frame: i32,
|
||||
animation_data: AnimationData,
|
||||
fps: i16,
|
||||
) -> Vec<f32> {
|
||||
) -> Vec<Float> {
|
||||
animated_value.get_values_at_frame_range(start_frame, end_frame, &animation_data, fps)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[cfg_attr(feature = "tauri", tauri::command)]
|
||||
pub fn get_values_at_frame_range_from_animated_float_vec2(
|
||||
animated_value: AnimatedFloatVec2,
|
||||
start_frame: i32,
|
||||
end_frame: i32,
|
||||
animation_data: AnimationData,
|
||||
fps: i16,
|
||||
) -> Vec<(f32, f32)> {
|
||||
) -> Vec<FloatVec2> {
|
||||
animated_value.get_values_at_frame_range(start_frame, end_frame, &animation_data, fps)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[cfg_attr(feature = "tauri", tauri::command)]
|
||||
pub fn get_values_at_frame_range_from_animated_float_vec3(
|
||||
animated_value: AnimatedFloatVec3,
|
||||
start_frame: i32,
|
||||
end_frame: i32,
|
||||
animation_data: AnimationData,
|
||||
fps: i16,
|
||||
) -> Vec<(f32, f32, f32)> {
|
||||
) -> Vec<FloatVec3> {
|
||||
animated_value.get_values_at_frame_range(start_frame, end_frame, &animation_data, fps)
|
||||
}
|
||||
|
||||
@@ -110,6 +113,7 @@ impl AnimatedValue<f32> for AnimatedFloat {
|
||||
.get_value_at_frame(curr_frame, &animation_data, fps)
|
||||
}
|
||||
|
||||
#[cfg(feature = "parallelization")]
|
||||
fn get_values_at_frame_range(
|
||||
&self,
|
||||
start_frame: i32,
|
||||
@@ -124,6 +128,22 @@ impl AnimatedValue<f32> for AnimatedFloat {
|
||||
|
||||
values
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "parallelization"))]
|
||||
fn get_values_at_frame_range(
|
||||
&self,
|
||||
start_frame: i32,
|
||||
end_frame: i32,
|
||||
animation_data: &AnimationData,
|
||||
fps: i16,
|
||||
) -> Vec<f32> {
|
||||
let values = (start_frame..end_frame)
|
||||
.into_iter()
|
||||
.map(|i| self.get_value_at_frame(i, animation_data, fps))
|
||||
.collect();
|
||||
|
||||
values
|
||||
}
|
||||
}
|
||||
|
||||
impl AnimatedValue<(f32, f32, f32)> for AnimatedFloatVec3 {
|
||||
@@ -178,7 +198,7 @@ impl AnimatedValue<(f32, f32, f32)> for AnimatedFloatVec3 {
|
||||
.get_values_at_frame_range(start_frame, end_frame, animation_data, fps);
|
||||
|
||||
let vectors: Vec<(f32, f32, f32)> = x
|
||||
.into_par_iter()
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(index, val_x)| {
|
||||
let val_y: f32 = *y.get(index).unwrap();
|
||||
@@ -234,7 +254,7 @@ impl AnimatedValue<(f32, f32)> for AnimatedFloatVec2 {
|
||||
.get_values_at_frame_range(start_frame, end_frame, animation_data, fps);
|
||||
|
||||
let vectors: Vec<(f32, f32)> = x
|
||||
.into_par_iter()
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(index, val_x)| {
|
||||
let val_y: f32 = *y.get(index).unwrap();
|
||||
2
lib/creator_rs/src/animation/primitives/values/mod.rs
Normal file
2
lib/creator_rs/src/animation/primitives/values/mod.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
pub mod animated_values;
|
||||
pub mod values;
|
||||
4
lib/creator_rs/src/animation/primitives/values/values.rs
Normal file
4
lib/creator_rs/src/animation/primitives/values/values.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
pub type Float = f32;
|
||||
pub type FloatVec2 = (f32, f32);
|
||||
pub type FloatVec3 = (f32, f32, f32);
|
||||
pub type FloatVec4 = (f32, f32, f32, f32);
|
||||
@@ -1,12 +1,3 @@
|
||||
use std::str::FromStr;
|
||||
|
||||
use crate::animation::primitives::{
|
||||
interpolations::{EasingFunction, InterpolationType, SpringProperties},
|
||||
keyframe::{Keyframe, Keyframes},
|
||||
};
|
||||
use rayon::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::primitives::{
|
||||
entities::{
|
||||
common::{AnimatedEntity, AnimationData, Cache, Entity},
|
||||
@@ -14,8 +5,17 @@ use super::primitives::{
|
||||
text::AnimatedTextEntity,
|
||||
},
|
||||
paint::{Color, FillStyle, Paint, PaintStyle, StrokeStyle, TextAlign, TextPaint},
|
||||
values::{AnimatedFloat, AnimatedFloatVec2},
|
||||
values::animated_values::{AnimatedFloat, AnimatedFloatVec2},
|
||||
};
|
||||
use crate::animation::primitives::{
|
||||
interpolations::{EasingFunction, InterpolationType, SpringProperties},
|
||||
keyframe::{Keyframe, Keyframes},
|
||||
};
|
||||
#[cfg(feature = "parallelization")]
|
||||
use rayon::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::str::FromStr;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Input {
|
||||
@@ -38,6 +38,7 @@ pub struct RenderState {
|
||||
}
|
||||
|
||||
impl Timeline {
|
||||
#[cfg(feature = "parallelization")]
|
||||
fn calculate(&self) -> Vec<Entity> {
|
||||
let mut entities = self.entities.clone();
|
||||
|
||||
@@ -50,6 +51,20 @@ impl Timeline {
|
||||
|
||||
return entities;
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "parallelization"))]
|
||||
fn calculate(&self) -> Vec<Entity> {
|
||||
let mut entities = self.entities.clone();
|
||||
|
||||
let entities = entities
|
||||
.iter_mut()
|
||||
.map(|entity| entity.calculate(self))
|
||||
.filter(|entity| entity.is_some())
|
||||
.map(|entity| entity.unwrap())
|
||||
.collect();
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
|
||||
fn build_bg(offset: f32, paint: Paint, size: (i32, i32)) -> AnimatedRectEntity {
|
||||
@@ -126,11 +141,24 @@ fn build_bg(offset: f32, paint: Paint, size: (i32, i32)) -> AnimatedRectEntity {
|
||||
return bg_box;
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn calculate_timeline_entities_at_frame(timeline: Timeline) -> Vec<Entity> {
|
||||
#[cfg_attr(feature = "tauri", tauri::command)]
|
||||
pub fn calculate_timeline_at_curr_frame(timeline: Timeline) -> Vec<Entity> {
|
||||
timeline.calculate()
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
pub fn calculate_timeline_from_json_at_curr_frame(timeline_json: &str) -> String {
|
||||
// TODO: Handle failure instead of unwrap
|
||||
let timeline: Timeline = serde_json::from_str(timeline_json).unwrap();
|
||||
|
||||
let entities = calculate_timeline_at_curr_frame(timeline);
|
||||
|
||||
// TODO: Handle failure instead of unwrap
|
||||
let entities_json = serde_json::to_string(&entities).unwrap();
|
||||
|
||||
entities_json
|
||||
}
|
||||
|
||||
pub fn test_timeline_entities_at_frame(
|
||||
render_state: RenderState,
|
||||
size: (i32, i32),
|
||||
@@ -1,6 +1,6 @@
|
||||
use font_kit::source::SystemSource;
|
||||
|
||||
#[tauri::command]
|
||||
#[cfg_attr(feature = "tauri", tauri::command)]
|
||||
pub fn get_system_fonts() -> Option<Vec<String>> {
|
||||
let source = SystemSource::new();
|
||||
|
||||
@@ -24,7 +24,7 @@ pub fn get_system_fonts() -> Option<Vec<String>> {
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[cfg_attr(feature = "tauri", tauri::command)]
|
||||
pub fn get_system_families() -> Option<Vec<String>> {
|
||||
let source = SystemSource::new();
|
||||
|
||||
@@ -33,7 +33,7 @@ pub fn get_system_families() -> Option<Vec<String>> {
|
||||
found_families.ok()
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[cfg_attr(feature = "tauri", tauri::command)]
|
||||
pub fn get_system_font(font_name: String) -> Option<Vec<u8>> {
|
||||
let source = SystemSource::new();
|
||||
|
||||
1
lib/creator_rs/src/fonts/mod.rs
Normal file
1
lib/creator_rs/src/fonts/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub mod fonts;
|
||||
3
lib/creator_rs/src/lib.rs
Normal file
3
lib/creator_rs/src/lib.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
pub mod animation;
|
||||
#[cfg(feature = "fonts")]
|
||||
pub mod fonts;
|
||||
@@ -3,7 +3,7 @@ import type { HTMLAttributes } from "astro/types";
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const button = cva(
|
||||
export const button = cva(
|
||||
cn(
|
||||
"inline-flex items-center justify-center rounded-md text-sm font-medium",
|
||||
"transition-colors focus-visible:outline-none",
|
||||
@@ -15,6 +15,8 @@ const button = cva(
|
||||
variants: {
|
||||
variant: {
|
||||
default: "bg-main text-neutral hocus:bg-main/80",
|
||||
primary:
|
||||
"bg-primary dark:bg-primary/50 text-neutral dark:text-main hocus:bg-primary/80 dark:hocus:bg-primary/80",
|
||||
destructive:
|
||||
"bg-error text-destructive-foreground hocus:bg-destructive/90",
|
||||
outline:
|
||||
|
||||
18
web/src/components/Layout/Header.astro
Normal file
18
web/src/components/Layout/Header.astro
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
import Button, { button } from "../Button.astro";
|
||||
import TempbladeLogo from "components/Logo/tempblade.astro";
|
||||
---
|
||||
|
||||
<header class="fixed top-0 w-full h-16 z-50">
|
||||
<div
|
||||
class="flex flex-row justify-between h-full w-full max-w-section m-auto p-main"
|
||||
>
|
||||
<div class="w-16 h-8 flex">
|
||||
<TempbladeLogo />
|
||||
</div>
|
||||
<a
|
||||
class={button({ variant: "primary", size: "default" })}
|
||||
href="https://github.com/tempblade/creator/releases">Download</a
|
||||
>
|
||||
</div>
|
||||
</header>
|
||||
43
web/src/components/Logo/tempblade.astro
Normal file
43
web/src/components/Logo/tempblade.astro
Normal file
@@ -0,0 +1,43 @@
|
||||
<svg
|
||||
width="100%"
|
||||
height="100%"
|
||||
viewBox="0 0 372 306"
|
||||
version="1.1"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xml:space="preserve"
|
||||
style="fill-rule:evenodd;clip-rule:evenodd;stroke-miterlimit:1.5;"
|
||||
>
|
||||
<g>
|
||||
<g id="Tb">
|
||||
<path
|
||||
id="T"
|
||||
d="M250.532,6.303L250.532,56.321L157.88,56.321L157.88,233.339L100.536,233.339L100.536,56.321L6.186,56.321L6.186,6.303L250.532,6.303Z"
|
||||
style="fill:url(#_Linear2);fill-rule:nonzero;"></path>
|
||||
<path
|
||||
id="b"
|
||||
class="stroke-main"
|
||||
d="M133.511,6.303L133.511,41.339L172.011,41.339L172.171,248.131L204.414,248.131L204.414,280.374L317.268,280.374L317.268,248.131L349.511,248.131L349.511,151.4L317.268,151.4L317.268,119.156L235.046,119.156L235.046,151.4"
|
||||
style="fill:none;stroke-width:30.45px;"></path>
|
||||
</g>
|
||||
</g>
|
||||
<defs>
|
||||
<linearGradient
|
||||
id="_Linear2"
|
||||
x1="0"
|
||||
y1="0"
|
||||
x2="1"
|
||||
y2="0"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(244.346,0,0,227.036,6.18639,119.821)"
|
||||
><stop
|
||||
offset="0"
|
||||
class="text-main"
|
||||
style="stop-color:currentColor;stop-opacity:1"></stop>
|
||||
<stop
|
||||
offset="1"
|
||||
class="text-main/50"
|
||||
style="stop-color:currentColor;stop-opacity:1"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -1,5 +1,6 @@
|
||||
---
|
||||
import Footer from "@/components/Layout/Footer.astro";
|
||||
import Header from "@/components/Layout/Header.astro";
|
||||
import "@/styles/global.css";
|
||||
|
||||
export interface Props {
|
||||
@@ -24,6 +25,7 @@ const { title } = Astro.props;
|
||||
<title>{title}</title>
|
||||
</head>
|
||||
<body>
|
||||
<Header />
|
||||
<slot />
|
||||
<Footer />
|
||||
</body>
|
||||
|
||||
@@ -69,6 +69,4 @@ const features: Array<Feature> = [
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
console.log(cardsContainer);
|
||||
</script>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import Heading from "@/components/Heading.astro";
|
||||
---
|
||||
|
||||
<div class="flex flex-col gap-4">
|
||||
<div id="introduction-content-container" class="flex flex-col gap-4">
|
||||
<Heading>
|
||||
The Next Generation Motion Design Tool - Free & Open Source
|
||||
</Heading>
|
||||
@@ -28,3 +28,26 @@ import Heading from "@/components/Heading.astro";
|
||||
patreon!
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
import { ease } from "@unom/style";
|
||||
import { animate, inView, stagger } from "motion";
|
||||
|
||||
const contentContainer = document.getElementById(
|
||||
"introduction-content-container"
|
||||
);
|
||||
|
||||
const children = document.querySelectorAll(
|
||||
"#introduction-content-container *"
|
||||
);
|
||||
|
||||
if (contentContainer) {
|
||||
inView(contentContainer, () => {
|
||||
animate(
|
||||
children,
|
||||
{ y: [20, 0], opacity: [0, 1] },
|
||||
{ ...ease.quint(0.8).out, delay: stagger(0.1) }
|
||||
);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
import Button from "@/components/Button.astro";
|
||||
import TempbladeLogo from "@/components/Logo/tempblade.astro";
|
||||
---
|
||||
|
||||
<div class="h-[80vh] relative w-full overflow-x-hidden">
|
||||
@@ -8,29 +8,47 @@ import Button from "@/components/Button.astro";
|
||||
class="z-0 absolute top-0 flex items-center w-full h-full justify-center object-center object-contain"
|
||||
id="landing-bg-container"
|
||||
>
|
||||
<canvas width="1920" height="1080" class="w-[800px]" id="landing-bg"
|
||||
<canvas width="1920" height="1080" class="w-[900px]" id="landing-bg"
|
||||
></canvas>
|
||||
</aside>
|
||||
<div
|
||||
class="z-10 relative w-full h-full flex items-center flex-col justify-center"
|
||||
>
|
||||
<div class="flex flex-col justify-center items-center gap-2">
|
||||
<h1 class="text-5xl dark:text-neutral text-center font-black">
|
||||
tempblade Creator
|
||||
<div
|
||||
id="landing-content-container"
|
||||
class="flex flex-col justify-center items-center gap-2 p-main dark:text-neutral"
|
||||
>
|
||||
<!-- <div data-animate class="w-12 h-12">
|
||||
<TempbladeLogo />
|
||||
</div> -->
|
||||
<h1
|
||||
data-animate
|
||||
class="text-6xl lg:text-8xl text-center font-black text-current"
|
||||
>
|
||||
Creator
|
||||
</h1>
|
||||
<h2 class="text-center dark:text-neutral text-xl font-normal">
|
||||
Rust Based Open Source Motion Design Editor & Toolkit
|
||||
<h2 class="text-center text-xl font-normal max-w-xs">
|
||||
<span class="inline-block" data-animate>
|
||||
Rust Based Open Source</span
|
||||
><br />
|
||||
<span class="inline-block" data-animate>
|
||||
Motion Design Editor & Toolkit</span
|
||||
>
|
||||
</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
import { animate, inView } from "motion";
|
||||
import { animate, inView, stagger } from "motion";
|
||||
import { ease } from "@unom/style";
|
||||
|
||||
const landingBgContainer = document.getElementById("landing-bg");
|
||||
|
||||
const children = document.querySelectorAll(
|
||||
"#landing-content-container [data-animate]"
|
||||
);
|
||||
|
||||
if (landingBgContainer) {
|
||||
inView(landingBgContainer, () => {
|
||||
animate(
|
||||
@@ -41,6 +59,17 @@ import Button from "@/components/Button.astro";
|
||||
},
|
||||
{ ...ease.quint(2).out }
|
||||
);
|
||||
animate(
|
||||
children,
|
||||
{ y: [50, 0], opacity: [0, 1] },
|
||||
{
|
||||
opacity: {
|
||||
easing: "linear",
|
||||
},
|
||||
...ease.quint(0.8).out,
|
||||
delay: stagger(0.1),
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
:root {
|
||||
--color-main: 0 0% 0%;
|
||||
--color-main: 0 0% 10%;
|
||||
--color-primary: 0 0% 0%;
|
||||
--color-primary: 280 80% 50%;
|
||||
--color-neutral: 0 0% 100%;
|
||||
--color-neutral-accent: 0 0% 93%;
|
||||
--color-highlight: 264 100% 50%;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const plugin = require("tailwindcss/plugin");
|
||||
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
|
||||
@@ -55,5 +57,9 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
plugins: [
|
||||
plugin(function ({ addVariant }) {
|
||||
addVariant("hocus", ["&:hover", "&:focus"]);
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user