[feat] animations
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
import tippy from 'tippy.js'
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
|
||||
export const CCLicenseData = {
|
||||
"CC BY 4.0": ["by", "Requires Attribution"],
|
||||
"CC BY-NC 4.0": ["by-nc", "Requires Attribution and Non Commercial"],
|
||||
@@ -8,17 +5,4 @@ export const CCLicenseData = {
|
||||
"CC BY-SA 4.0": ["by-sa", "Requires Attribution and Share Alike"],
|
||||
"CC BY-ND 4.0": ["by-nd", "Requires Attribution and No Derivatives"],
|
||||
"CC BY-NC-ND 4.0": ["by-nc-nd", "Requires Attribution, Non Commercial and No Derivatives"],
|
||||
}
|
||||
|
||||
export function tooltip(node:HTMLElement, tip:string) {
|
||||
const instance = tippy(node, {
|
||||
content: tip,
|
||||
animation: 'fade',
|
||||
arrow: true,
|
||||
})
|
||||
return {
|
||||
destroy() {
|
||||
instance.destroy()
|
||||
}
|
||||
};
|
||||
}
|
||||
7
src/ts/gui/animation.ts
Normal file
7
src/ts/gui/animation.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { get } from "svelte/store";
|
||||
import { DataBase } from "../storage/database";
|
||||
|
||||
export function updateAnimationSpeed(){
|
||||
const db = get(DataBase);
|
||||
document.documentElement.style.setProperty('--risu-animation-speed', db.animationSpeed + 's');
|
||||
}
|
||||
15
src/ts/gui/tooltip.ts
Normal file
15
src/ts/gui/tooltip.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import tippy from 'tippy.js'
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
|
||||
export function tooltip(node:HTMLElement, tip:string) {
|
||||
const instance = tippy(node, {
|
||||
content: tip,
|
||||
animation: 'fade',
|
||||
arrow: true,
|
||||
})
|
||||
return {
|
||||
destroy() {
|
||||
instance.destroy()
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -283,6 +283,8 @@ export function setDatabase(data:Database){
|
||||
data.toggleConfirmRecommendedPreset ??= true
|
||||
data.officialplugins ??= {}
|
||||
data.assetWidth ??= -1
|
||||
data.animationSpeed ??= 0.2
|
||||
|
||||
changeLanguage(data.language)
|
||||
DataBase.set(data)
|
||||
}
|
||||
@@ -576,6 +578,7 @@ export interface Database{
|
||||
icon:string
|
||||
}[]
|
||||
assetWidth:number
|
||||
animationSpeed:number
|
||||
}
|
||||
|
||||
interface hordeConfig{
|
||||
|
||||
@@ -20,6 +20,7 @@ import { defaultJailbreak, defaultMainPrompt, oldJailbreak, oldMainPrompt } from
|
||||
import { loadRisuAccountData } from "../drive/accounter";
|
||||
import { decodeRisuSave, encodeRisuSave } from "./risuSave";
|
||||
import { AutoStorage } from "./autoStorage";
|
||||
import { updateAnimationSpeed } from "../gui/animation";
|
||||
|
||||
//@ts-ignore
|
||||
export const isTauri = !!window.__TAURI__
|
||||
@@ -419,6 +420,7 @@ export async function loadData() {
|
||||
} catch (error) {}
|
||||
await checkNewFormat()
|
||||
updateTextTheme()
|
||||
updateAnimationSpeed()
|
||||
if(get(DataBase).account){
|
||||
try {
|
||||
await loadRisuAccountData()
|
||||
|
||||
Reference in New Issue
Block a user