Эх сурвалжийг харах

app: final bg vid tweaks for release. darken bg on actual chats with a subtle gradient, diff sizes for mobile and desktop.

darkfi 9 сар өмнө
parent
commit
1ed1dd35fc

+ 21 - 11
bin/app/Makefile

@@ -39,23 +39,23 @@ linux-release: build-release
 	-mv darkfi-app darkfi-app.linux
 linux-debug: build-debug
 	-mv darkfi-app darkfi-app_debug.linux
-win-release: $(SRC) fonts forest.zip
+win-release: $(SRC) fonts
 	$(CARGO) build --release $(RELEASE_FEATURES)
 	-mv target/release/darkfi-app.exe .
-win-debug: $(SRC) fonts forest.zip
+win-debug: $(SRC) fonts
 	$(CARGO) build $(DEBUG_FEATURES)
 	-mv target/debug/darkfi-app.exe .
-android-release: $(SRC) fonts forest.zip
+android-release: $(SRC) fonts forest_720x1080
 	podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build --release $(RELEASE_FEATURES)
 	-mv $(RELEASE_APK) darkfi-app.apk
-android-debug: $(SRC) fonts
+android-debug: $(SRC) fonts forest_720x1080
 	podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build $(DEBUG_FEATURES)
 	-mv $(DEBUG_APK) darkfi-app_debug.apk
 
-build-release: $(SRC) fonts forest.zip
+build-release: $(SRC) fonts forest_1920x1080
 	$(CARGO) build --release $(RELEASE_FEATURES)
 	-mv target/release/darkfi-app .
-build-debug: $(SRC) fonts forest.zip
+build-debug: $(SRC) fonts forest_1920x1080
 	$(CARGO) build $(DEBUG_FEATURES)
 	-mv target/debug/darkfi-app .
 
@@ -69,18 +69,28 @@ ibm-plex-mono-regular.otf:
 NotoColorEmoji.ttf:
 	wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/NotoColorEmoji.ttf
 
-forest.zip:
-	wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/forest.zip
-	cd assets && unzip ../forest.zip
+forest_1920x1080.zip:
+	wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/forest_1920x1080.zip
+assets/forest_1920x1080/000.qoi:
+	cd assets && unzip ../forest_1920x1080.zip
+forest_1920x1080: forest_1920x1080.zip assets/forest_1920x1080/000.qoi
+	rm -fr assets/forest_729x1280/
+
+forest_720x1280.zip:
+	wget -c https://codeberg.org/darkrenaissance/darkfi/raw/branch/data/forest_720x1280.zip
+assets/forest_720x1280/000.qoi:
+	cd assets && unzip ../forest_720x1280.zip
+forest_720x1280: forest_720x1280.zip assets/forest_720x1280/000.qoi
+	rm -fr assets/forest_1920x1080/
 
 # Developer targets
 
-dev: $(SRC) fonts forest.zip
+dev: $(SRC) fonts forest_1920x1080
 	$(CARGO) lbuild $(DEV_FEATURES)
 	-mv target/debug/darkfi-app .
 	./darkfi-app
 
-apk: $(SRC) fonts forest.zip
+apk: $(SRC) fonts forest_720x1280
 	podman run -v $(shell pwd)/../../:/root/darkfi -w /root/darkfi/bin/app/ -t apk cargo quad-apk build $(DEV_FEATURES)
 	$(MAKE) install-apk
 

BIN
bin/app/assets/bg.png


+ 21 - 0
bin/app/src/app/schema/chat.rs

@@ -231,6 +231,27 @@ pub async fn make(
     let layer_node = layer_node.setup(|me| Layer::new(me, app.render_api.clone())).await;
     window.link(layer_node.clone());
 
+    // Create a bg mesh on top to fade the bg image
+    let node = create_vector_art("bg");
+    let prop = node.get_property("rect").unwrap();
+    prop.set_f32(atom, Role::App, 0, 0.).unwrap();
+    prop.set_f32(atom, Role::App, 1, 0.).unwrap();
+    prop.set_expr(atom, Role::App, 2, expr::load_var("w")).unwrap();
+    prop.set_expr(atom, Role::App, 3, expr::load_var("h")).unwrap();
+    node.set_property_u32(atom, Role::App, "z_index", 0).unwrap();
+
+    // Setup the pimpl
+    let mut shape = VectorShape::new();
+    shape.add_gradient_box(
+        expr::const_f32(0.),
+        expr::const_f32(0.),
+        expr::load_var("w"),
+        expr::load_var("h"),
+        [[0., 0., 0., 0.5], [0., 0., 0., 0.5], [0., 0., 0., 0.5], [0., 0., 0., 0.8]],
+    );
+    let node = node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
+    layer_node.link(node);
+
     // Create the toolbar bg
     let node = create_vector_art("toolbar_bg");
     let prop = node.get_property("rect").unwrap();

+ 5 - 30
bin/app/src/app/schema/mod.rs

@@ -56,8 +56,8 @@ mod ui_consts {
     use crate::android::{get_appdata_path, get_external_storage_path};
     use std::path::PathBuf;
 
-    //pub const BG_PATH: &str = "bg.png";
-    pub const VID_PATH: &str = "forest8/forest{frame}.qoi";
+    pub const VID_PATH: &str = "forest_720x1280/{frame}.qoi";
+    pub const VID_ASPECT_RATIO: f32 = 9. / 16.;
     pub use super::android_ui_consts::*;
 
     pub fn get_chatdb_path() -> PathBuf {
@@ -81,8 +81,8 @@ mod ui_consts {
 mod desktop_paths {
     use std::path::PathBuf;
 
-    //pub const BG_PATH: &str = "assets/bg.png";
-    pub const VID_PATH: &str = "assets/forest8/forest{frame}.qoi";
+    pub const VID_PATH: &str = "assets/forest_1920x1080/{frame}.qoi";
+    pub const VID_ASPECT_RATIO: f32 = 16. / 9.;
 
     pub fn get_chatdb_path() -> PathBuf {
         dirs::data_local_dir().unwrap().join("darkfi/app/chatdb")
@@ -245,9 +245,7 @@ pub async fn make(app: &App, window: SceneNodePtr, i18n_fish: &I18nBabelFish) {
         prop.set_expr(atom, Role::App, 2, expr::load_var("w")).unwrap();
         prop.set_expr(atom, Role::App, 3, expr::load_var("h")).unwrap();
 
-        // Image aspect ratio
-        let r = 1.78;
-        cc.add_const_f32("R", r);
+        cc.add_const_f32("R", VID_ASPECT_RATIO);
 
         let prop = node.get_property("uv").unwrap();
         #[rustfmt::skip]
@@ -300,29 +298,6 @@ pub async fn make(app: &App, window: SceneNodePtr, i18n_fish: &I18nBabelFish) {
         node.set_property_u32(atom, Role::App, "length", 150).unwrap();
         let node = node.setup(|me| Video::new(me, app.render_api.clone(), app.ex.clone())).await;
         layer_node.link(node);
-
-        // Create a bg mesh on top to fade the bg image
-        let node = create_vector_art("bg");
-        let prop = node.get_property("rect").unwrap();
-        prop.set_f32(atom, Role::App, 0, 0.).unwrap();
-        prop.set_f32(atom, Role::App, 1, 0.).unwrap();
-        prop.set_expr(atom, Role::App, 2, expr::load_var("w")).unwrap();
-        prop.set_expr(atom, Role::App, 3, expr::load_var("h")).unwrap();
-        node.set_property_u32(atom, Role::App, "z_index", 1).unwrap();
-
-        //let c = if LIGHTMODE { 1. } else { 0. };
-        let c = 0.;
-        // Setup the pimpl
-        let mut shape = VectorShape::new();
-        shape.add_filled_box(
-            expr::const_f32(0.),
-            expr::const_f32(0.),
-            expr::load_var("w"),
-            expr::load_var("h"),
-            [c, c, c, 0.3],
-        );
-        let node = node.setup(|me| VectorArt::new(me, shape, app.render_api.clone())).await;
-        layer_node.link(node);
     } else if COLOR_SCHEME == ColorScheme::PaperLight {
         let node = create_vector_art("bg");
         let prop = node.get_property("rect").unwrap();