-
Notifications
You must be signed in to change notification settings - Fork 330
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
Placing animation inside widget #335
Comments
I think the best way to achieve this is to provide a new animation ani;
ani.push_back(fset);
ani.output(fm, [&fm]{
//Keeps the picture in the center of widget.
return point((fm.size().width - picture_width) / 2, (fm.size().height - picture_height)/ 2);
});
ani.looped(true);
ani.play(); What about it? |
Would it be possible to make ani.output() take a nana::picture or nana::panel or something like that, so that I can place the picture/panel as normal within the form? Also, if I want to write my own widget that aggregates nana::animation, I will be drawing to the widget itself and not to the window. Users (me) will then place that widget without thinking there are animations and whatnot inside. Is that possible at all? Sorry if it's not supposed to work like that, I'm new to nana. |
The first parameter of output accepts a widget which is not a lite-widget. e.g. For the second question, i mentioned a new output overloading that means it will renders the animation at a given position(the coordinate is referenced by the first parameter of output method) in the widget. In above example, it indicates the animation always keeps being rendered in the center of the widget no matter how the widget is resized. |
Can I get some help on this please? I've been stuck for days now. I managed to create a custom widget on which I can draw but I'm having several problems. First, this code just segfaults:
The reason I'm trying to do it like that is because of the problems I first encountered with std::array<nana::animation, 15>. For example calling anims[z].fps(3); causes a deadlock. anims[z].looped(true) and anims[z].play() also cause a deadlock in some cases. I was first calling those in my trigger::attached() function and pretty much everything deadlocks there. So I moved what I could to the trigger constructor, and only the call to fps() deadlocks there. The std::vector version segfaults. |
Here is the basic usage of animation.
From your example.
It crashes because the animation is non-copyable. But I didn't delete the copy-constructor and assignment operator. it's a bug. |
Sorry if this is a simple question but reading the documentation for 1.6.2 I can't find how to display animations inside widgets.
I want to display small icon-like animations in a grid. The grid itself should be placed on the main window and react to the window being resized, for example I want the grid to behave similarly to how the button behaves in the sample code on nana's home page. In other words the grid itself should be a widget (maybe a custom one I should write), where icons are at fixed position from each other, but the grid widget itself should not be at a fixed position in the main window.
All I could find so far is this. The example there takes fixed coordinates and draws on the window directly, so resizing the window will leave animations at fixed places.
What widget should I use to achieve this?
The text was updated successfully, but these errors were encountered: