Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add animation when objects are opened #20

Open
probonopd opened this issue Dec 9, 2020 · 5 comments
Open

Add animation when objects are opened #20

probonopd opened this issue Dec 9, 2020 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed qt Qt expertise needed

Comments

@probonopd
Copy link
Member

E.g., Open animation like in https://user-images.githubusercontent.com/900690/51821977-24acd700-22db-11e9-865a-17490e445f35.gif

@probonopd
Copy link
Member Author

probonopd commented Apr 5, 2021

In the Dock we have implemented this and it was actually very easy, but the Dock is written in Qml.

How do we do this in Filer?
https://doc.qt.io/qt-5/qpropertyanimation.html

Something in libfm-qt/filelauncher.cpp along the lines of

#include <QPropertyAnimation>

bool FileLauncher::launchFiles(QWidget* parent, GList* file_infos) {
    qDebug() << "probono: FileLauncher::launchFiles called";
    qDebug() << "probono: parent:" << parent;

    QPropertyAnimation *animation = new QPropertyAnimation(parent, "pos");
    animation->setTargetObject(parent);
    animation->setDuration(1500);
    animation->setEndValue(QPoint(400, 400)); // Actually we want to increase the size, as we do in the Dock
    animation->start();
    // FIXME: QPropertyAnimation::updateState (pos): Changing state of an animation without target

maybe?

I think our bool FileLauncher::launchFiles(QWidget* parent, GList* file_infos) method needs to be changed:

  • Whatever is meant with QWidget* parent, it is not the icon in the list view that is being launched, and often it is nullptr
  • GList* file_infos can contain multiple files
  • Hence, we need to pass in a a list of QWidgets (the icon in the list view)? Hwo to do this?

cc @moochris

@probonopd probonopd added enhancement New feature or request help wanted Extra attention is needed labels Apr 5, 2021
@probonopd
Copy link
Member Author

probonopd commented Nov 27, 2022

In desktopitemdelegate.cpp, we may need to add a Q_PROPERTY for what we want to animate (e.g., size and/or opacity)

https://stackoverflow.com/a/52856454

Then we can use a QPropertyAnimation https://felgo.com/doc/qt/qpropertyanimation/

or a QVariantAnimation to animate that property similar to

    auto moveAnimation = new QPropertyAnimation( &t,  "pos" );
    moveAnimation->setDuration( 10000 );
    moveAnimation->setStartValue( QPointF(640, 680) );
    moveAnimation->setEndValue(  QPointF(0, 0) );
    moveAnimation->setEasingCurve( QEasingCurve::Linear );
    moveAnimation->start(QAbstractAnimation::DeleteWhenStopped);

https://stackoverflow.com/q/52853322

Need to play with https://github.com/kimtaikee/resizeAnimation examples.

@probonopd probonopd pinned this issue Nov 27, 2022
@probonopd probonopd added the qt Qt expertise needed label Nov 27, 2022
@probonopd
Copy link
Member Author

While the icon is increased, we can slowly fade it out; maybe using https://doc.qt.io/qt-5/qgraphicsopacityeffect.html?

@probonopd
Copy link
Member Author

If the opened item is a folder, the folder's window appears instantly; we might use a KWin animatin for it.

If the launched item is an application, we may need to animate the application icon instead because a window may or may not appear immediately.

probonopd added a commit to probonopd/Filer that referenced this issue Jul 29, 2023
Works reasonably well on the desktop; does not work 100% correctly inside folders yet

References:
* helloSystem/Filer#20
* helloSystem/hello#86
@probonopd
Copy link
Member Author

It looks like it can be done using QTimeLine Property Animation.
Proof-of-concept is here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed qt Qt expertise needed
Projects
None yet
Development

No branches or pull requests

1 participant