__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
// SPDX-License-Identifier: MIT OR LGPL-2.0-or-later // SPDX-FileCopyrightText: 2022 Andy Holmes <[email protected]> import Gtk from 'gi://Gtk?version=4.0'; import GLib from 'gi://GLib'; function easeInOutQuad(p) { if ((p *= 2.0) < 1.0) return 0.5 * p * p; return -0.5 * (--p * (p - 2) - 1); } // When the button is clicked, we'll add a tick callback to run the animation function _onButtonClicked(widget) { // Prevent concurrent animations from being triggered if (widget._animationId) return; const duration = 1000; // one second in milliseconds let start = Date.now(); let fadeIn = false; // Tick callbacks are just like GSource callbacks. You will get a ID that // can be passed to Gtk.Widget.remove_tick_callback(), or you can return // GLib.SOURCE_CONTINUE and GLib.SOURCE_REMOVE as appropriate. widget._animationId = widget.add_tick_callback(() => { let now = Date.now(); // We've now passed the time duration if (now >= start + duration) { // If we just finished fading in, we're all done if (fadeIn) { widget._animationId = null; return GLib.SOURCE_REMOVE; } // If we just finished fading out, we'll start fading in fadeIn = true; start = now; } // Apply the easing function to the current progress let progress = (now - start) / duration; progress = easeInOutQuad(progress); // We are using the progress as the opacity value of the button widget.opacity = fadeIn ? progress : 1.0 - progress; return GLib.SOURCE_CONTINUE; }); } // Initialize GTK Gtk.init(); const loop = GLib.MainLoop.new(null, false); // Create a button to start the animation const button = new Gtk.Button({ label: 'Fade out, fade in', valign: Gtk.Align.CENTER, halign: Gtk.Align.CENTER, }); button.connect('clicked', _onButtonClicked); // Create a top-level window const win = new Gtk.Window({ title: 'GTK4 Frame Clock', default_width: 300, default_height: 250, child: button, }); // When a widget is destroyed any tick callbacks will be removed automatically, // so in practice our callback would be cleaned up when the window closes. win.connect('close-request', () => { // Note that removing a tick callback by ID will interrupt its progress, so // we are resetting the button opacity manually after it's removed. if (button._animationId) { button.remove_tick_callback(button._animationId); button.opacity = 1.0; } loop.quit(); }); // Show the window win.present(); loop.run();
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| README | File | 80 B | 0644 |
|
| calc.js | File | 3.55 KB | 0644 |
|
| dbus-client.js | File | 4.72 KB | 0644 |
|
| dbus-service.js | File | 3.42 KB | 0644 |
|
| gettext.js | File | 751 B | 0644 |
|
| gio-cat.js | File | 731 B | 0644 |
|
| glistmodel.js | File | 3.69 KB | 0644 |
|
| gtk-application.js | File | 3.64 KB | 0644 |
|
| gtk3-template.js | File | 1.57 KB | 0644 |
|
| gtk3-template.ui | File | 1.61 KB | 0644 |
|
| gtk3.js | File | 2.51 KB | 0644 |
|
| gtk4-frame-clock.js | File | 2.63 KB | 0644 |
|
| gtk4-template.js | File | 1.64 KB | 0644 |
|
| gtk4-template.ui | File | 1.61 KB | 0644 |
|
| gtk4.js | File | 1.87 KB | 0644 |
|
| http-client.js | File | 1.71 KB | 0644 |
|
| http-server.js | File | 1.39 KB | 0644 |
|
| test.jpg | File | 35.55 KB | 0644 |
|
| test.jpg.license | File | 158 B | 0644 |
|
| timers.js | File | 524 B | 0644 |
|
| webkit.js | File | 438 B | 0644 |
|
| websocket-client.js | File | 1.44 KB | 0644 |
|