diff --git a/app/README.md b/app/README.md index 102e366..25789e2 100644 --- a/app/README.md +++ b/app/README.md @@ -1,7 +1,11 @@ -# Tauri + React + Typescript +# tempblade Creator -This template should help get you started developing with Tauri, React and Typescript in Vite. +This is the directory containing the application. It uses tauri with react/vite. -## Recommended IDE Setup +## Commands -- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) +Start the dev server: +```yarn tauri dev``` + +Create a production build: +```yarn tauri build``` diff --git a/app/package.json b/app/package.json index 4d72299..0e93696 100644 --- a/app/package.json +++ b/app/package.json @@ -15,6 +15,7 @@ "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-menubar": "^1.0.2", "@radix-ui/react-popover": "^1.0.6", + "@radix-ui/react-scroll-area": "^1.0.4", "@radix-ui/react-select": "^1.2.2", "@radix-ui/react-slider": "^1.1.1", "@radix-ui/react-toggle-group": "^1.0.4", diff --git a/app/src-tauri/Cargo.toml b/app/src-tauri/Cargo.toml index 79fb77a..490a266 100644 --- a/app/src-tauri/Cargo.toml +++ b/app/src-tauri/Cargo.toml @@ -17,7 +17,7 @@ tauri-build = { version = "1.3", features = [] } uuid = { version = "1.3.3", features = ["v4", "fast-rng", "macro-diagnostics"] } tauri = { version = "1.3", features = ["dialog-open", "dialog-save", "shell-open"] } -serde = { version = "1.0", features = ["derive"] } +serde = { version = "1.0", features = ["derive", "rc"] } serde_json = "1.0" tint = "1.0.0" simple-easing = "1.0.1" diff --git a/app/src-tauri/src/animation/primitives/keyframe.rs b/app/src-tauri/src/animation/primitives/keyframe.rs index 3e95046..d9cf43c 100644 --- a/app/src-tauri/src/animation/primitives/keyframe.rs +++ b/app/src-tauri/src/animation/primitives/keyframe.rs @@ -1,4 +1,4 @@ -use std::cmp::Ordering; +use std::{cmp::Ordering, sync::Arc}; use serde::{Deserialize, Serialize}; @@ -12,10 +12,26 @@ use super::{ pub struct Keyframe { pub value: f32, pub offset: f32, - pub id: String, + pub id: Arc, pub interpolation: Option, } +impl Keyframe { + pub fn new( + value: f32, + offset: f32, + id: Arc, + interpolation: Option, + ) -> Self { + Keyframe { + value, + offset, + id, + interpolation, + } + } +} + #[derive(Debug, Clone)] pub struct RenderedKeyframe { pub absolute_frame: i32, diff --git a/app/src-tauri/src/animation/primitives/tests.rs b/app/src-tauri/src/animation/primitives/tests.rs index 5cac4bb..1c2957d 100644 --- a/app/src-tauri/src/animation/primitives/tests.rs +++ b/app/src-tauri/src/animation/primitives/tests.rs @@ -25,19 +25,19 @@ fn interpolates_the_input() { let keyframes1 = Keyframes { values: vec![ Keyframe { - id: "1".to_string(), + id: "1".into(), value: 0.0, offset: 0.0, interpolation: None, }, Keyframe { - id: "2".to_string(), + id: "2".into(), value: 100.0, offset: 1.0, interpolation: None, }, Keyframe { - id: "3".to_string(), + id: "3".into(), value: 300.0, offset: 3.0, interpolation: None, @@ -48,13 +48,13 @@ fn interpolates_the_input() { let keyframes2 = Keyframes { values: vec![ Keyframe { - id: "4".to_string(), + id: "4".into(), value: -100.0, offset: 0.0, interpolation: None, }, Keyframe { - id: "5".to_string(), + id: "5".into(), value: 0.0, offset: 1.0, interpolation: None, @@ -150,19 +150,19 @@ fn gets_value_at_frame() { let keyframes = Keyframes { values: vec![ Keyframe { - id: "1".to_string(), + id: "1".into(), value: 0.0, offset: 0.0, interpolation: None, }, Keyframe { - id: "2".to_string(), + id: "2".into(), value: 100.0, offset: 1.0, interpolation: None, }, Keyframe { - id: "3".to_string(), + id: "3".into(), value: 300.0, offset: 3.0, interpolation: None, diff --git a/app/src-tauri/src/animation/primitives/values.rs b/app/src-tauri/src/animation/primitives/values.rs index 6d60835..5c6c3c5 100644 --- a/app/src-tauri/src/animation/primitives/values.rs +++ b/app/src-tauri/src/animation/primitives/values.rs @@ -29,7 +29,7 @@ impl AnimatedFloat { AnimatedFloat { keyframes: Keyframes { values: vec![Keyframe { - id: Uuid::new_v4().to_string(), + id: Uuid::new_v4().to_string().into(), value: val, offset: 0.0, interpolation: None, diff --git a/app/src-tauri/src/animation/timeline.rs b/app/src-tauri/src/animation/timeline.rs index 588a90f..5f3dfe0 100644 --- a/app/src-tauri/src/animation/timeline.rs +++ b/app/src-tauri/src/animation/timeline.rs @@ -70,7 +70,7 @@ fn build_bg(offset: f32, paint: Paint, size: (i32, i32)) -> AnimatedRectEntity { keyframes: Keyframes { values: vec![ Keyframe { - id: "1".to_string(), + id: "1".into(), value: (size.0 * -1) as f32, offset: 0.0, interpolation: Some(InterpolationType::EasingFunction( @@ -78,7 +78,7 @@ fn build_bg(offset: f32, paint: Paint, size: (i32, i32)) -> AnimatedRectEntity { )), }, Keyframe { - id: "2".to_string(), + id: "2".into(), value: 0.0, offset: 5.0, interpolation: None, @@ -89,7 +89,7 @@ fn build_bg(offset: f32, paint: Paint, size: (i32, i32)) -> AnimatedRectEntity { AnimatedFloat { keyframes: Keyframes { values: vec![Keyframe { - id: "3".to_string(), + id: "3".into(), value: 0.0, offset: 0.0, interpolation: None, @@ -103,7 +103,7 @@ fn build_bg(offset: f32, paint: Paint, size: (i32, i32)) -> AnimatedRectEntity { AnimatedFloat { keyframes: Keyframes { values: vec![Keyframe { - id: "4".to_string(), + id: "4".into(), interpolation: None, value: size.0 as f32, offset: 0.0, @@ -113,7 +113,7 @@ fn build_bg(offset: f32, paint: Paint, size: (i32, i32)) -> AnimatedRectEntity { AnimatedFloat { keyframes: Keyframes { values: vec![Keyframe { - id: "5".to_string(), + id: "5".into(), value: size.1 as f32, offset: 0.0, interpolation: None, @@ -159,7 +159,7 @@ pub fn test_timeline_entities_at_frame( color: Color::new(0, 0, 0, 1.0), width: 10.0, }), - font_name: "Arial".to_string(), + font_name: "Arial".into(), align: TextAlign::Center, size: 20.0, }; @@ -168,7 +168,7 @@ pub fn test_timeline_entities_at_frame( style: PaintStyle::Fill(FillStyle { color: Color::new(0, 0, 0, 1.0), }), - font_name: "Arial".to_string(), + font_name: "Arial".into(), align: TextAlign::Center, size: 10.0, }; @@ -198,7 +198,7 @@ pub fn test_timeline_entities_at_frame( keyframes: Keyframes { values: vec![ Keyframe { - id: "1".to_string(), + id: "1".into(), value: 0.0, offset: 0.0, interpolation: Some(InterpolationType::Spring( @@ -210,7 +210,7 @@ pub fn test_timeline_entities_at_frame( )), }, Keyframe { - id: "2".to_string(), + id: "2".into(), value: (size.0 / 2) as f32, offset: 2.0, interpolation: None, @@ -221,7 +221,7 @@ pub fn test_timeline_entities_at_frame( AnimatedFloat { keyframes: Keyframes { values: vec![Keyframe { - id: "3".to_string(), + id: "3".into(), value: (size.1 / 2) as f32, offset: 0.0, interpolation: None, @@ -248,7 +248,7 @@ pub fn test_timeline_entities_at_frame( keyframes: Keyframes { values: vec![ Keyframe { - id: "5".to_string(), + id: "5".into(), value: 0.0, offset: 0.0, interpolation: Some(InterpolationType::Spring( @@ -260,7 +260,7 @@ pub fn test_timeline_entities_at_frame( )), }, Keyframe { - id: "6".to_string(), + id: "6".into(), value: (size.0 / 2) as f32, offset: 2.0, @@ -272,7 +272,7 @@ pub fn test_timeline_entities_at_frame( AnimatedFloat { keyframes: Keyframes { values: vec![Keyframe { - id: "7".to_string(), + id: "7".into(), value: ((size.1 / 2) as f32) + 80.0, offset: 0.0, interpolation: None, diff --git a/app/src/App.tsx b/app/src/App.tsx index af3da3d..3a3852f 100644 --- a/app/src/App.tsx +++ b/app/src/App.tsx @@ -2,10 +2,11 @@ import "./App.css"; import Timeline from "./components/Timeline"; import Canvas from "./components/Canvas"; import Properties, { PropertiesContainer } from "components/Properties"; -import MenuBar from "components/MenuBar"; import ToolBar from "components/ToolBar"; import useKeyControls from "hooks/useKeyControls"; import { useFontsStore } from "stores/fonts.store"; +import * as ScrollArea from "@radix-ui/react-scroll-area"; +import ScrollBar from "components/ScrollArea"; export default function App() { const fontsStoreDidInit = useFontsStore((store) => store.didInit); @@ -13,26 +14,27 @@ export default function App() { useKeyControls(); return ( -
- +
+ {/* */}
{fontsStoreDidInit && ( -
-
- - - - -
- -
+ + +
+
+ + + + +
+ +
+
+ +
)}
); } - -{ - /* */ -} diff --git a/app/src/components/Inputs/Select.tsx b/app/src/components/Inputs/Select.tsx index 3d4ef90..b197876 100644 --- a/app/src/components/Inputs/Select.tsx +++ b/app/src/components/Inputs/Select.tsx @@ -17,7 +17,8 @@ const SelectTrigger = React.forwardRef< = ({ + title, + children, +}) => { + return ( +
+

{title}

+
{children}
+
+ ); +}; + +export default Panel; diff --git a/app/src/components/Properties/Primitives.tsx b/app/src/components/Properties/Primitives.tsx index 92c31ea..e4e8c93 100644 --- a/app/src/components/Properties/Primitives.tsx +++ b/app/src/components/Properties/Primitives.tsx @@ -36,12 +36,8 @@ export const PaintProperties: FC = ({ }) => { return (
-
- -
-