Is there any way I can use famo.us animation for an existing div - famo.us

I have div and menus already,
what I need is famo.us matrix animation,
is there a way,
I can use the existing element to do animation,
or is there any alternative.
I haven't created the div from famous,
and in that case I am sure I won't be able to manipulate with famo.us

Yes, just import/require famous/transitions/Transitionable, and animate any number you want, then use it's get() method to get your value and continuously set the value of whatever you want to animate. You can use a setInterval to continuously get the value(s) and set some CSS property of any div (e.g. the matrix3d() on a DIV).

Related

Change the order of ColumnLayout or ListView and save / restore it

I'm working on a stream overlay that extracts information out of a game (flight simulator) and displays it on the screen. Right now I'm using Qt in conjunction with a *.html to render the overlay. It is all working really well, however I wanted to add some customization options for the users of my overlay software and I figured the best way would be to render the Overlay in QML.
The main part of the overlay is a row that contains around 8 "elements" that display the relevant data.
One thing that should be customized is the order of the elements in the row. But I really have no idea how to implement this feature. I've seen a few posts and tutorials on how to customize the order in a View using the DelegateModel. However right now it's not a view but QML Components inserted in a RowLayout due to the fact that they are all different components (e.g. some of the images are actually animated for which I'm using a component that uses Canvas2D to draw the images). I guess I could figure out a way to store those elements in a model using the Loader Component to display the content in QML. But even then I'm not entirely sure how to store and restore the order of the elements. As far as I can tell the DelegateModel only changes the View and not the underlying model.
Any suggestion or best practice to accomplish my goal would be highly appreciated.

Is it possible to get an NCurses CDK Matrix to dynamically resize to the terminal window?

I have a bunch of items I want to display in a grid. I'd like the grid to dynamically resize based on the terminal window size. Basically I'd like it to fit as many columns as possible before adding another row. How should I go about this? Is the CDK matrix the right widget to use for this?
short: no
long: there are several points
CDK does not do any re-layout when reading KEY_RESIZE.
The matrix widget has no methods for adding or removing rows/columns.
While CDK allows binding of keys to callbacks, that probably does not work for special keys such as KEY_RESIZE.
You wouldn't be able to re-create (i.e., "resize") a matrix widget using a callback.
Rather, you might use the CDK widget as a starting point and see how to modify it to address the limitations noted above.

How to determine the content step value of scrollarea

I'm making my own UI from scratch using OpenGL that is why I'm asking this and please don't make any discouragement as this is just a hobby project.
Currently, I'm stuck implementing how this scrollbars really work. In my current implementation, the content scrolls at the wrong step value as well as the thumb, meaning, I set the value manually like 1px step for each of them.
The structure of my scrollbar implementation is describe as follows:
I draw scrollbars i.e the main rectangle where the 3 button lies.
Those 3 buttons are, thumb, buttonBack and buttonNext.
All of them do the basic logic of scrollbars i.e when I click each one of them, they moved. But the whole part(scrollbar) don't know how to scroll contents
So what I did is: I make another object and I call it scrollarea
It has two scrollbars, vertical and horizontal scrollbar.
I made a function called scrollToX and scrollToY which
does what I named to them.
But the step values I set to them are
manually set up.
I try to google some scrollbar, scrollarea, scrollview or whatever you call to that scrollable rectangle thing, but all I see are implementation and I cannot find any guides how to build your own. I have no choice but to look at their implementation. I try my best to comprehend what they did but their implementation of how their whole UI structure is very different to mine, and I cannot find anything useful there.
So I ask again here if anybody can explain me well how to make a properly functional scrollbar.
Most specific things I'm really concerned of are:
How do I determine the thumb step value?
How do I determine the content step value?
All of these depend on your content -
Is it just an image ? If so, you only need to change the offset depending on the size of the image.
Is it a list of values like in Windows explorer ? Then you need to create a data structure first that contains all of it, and shows the content that fits within the window as it scrolls.
OpenGL does not fit into this discussion.

How can we create custom slider?

I want to create a slider which contain a different slider handle and i want to paint it according to slider handle position in the slider.
You could use QProxyStyle to ovrride drawComplexControl method - you will have to draw entire control on your own, as there is no separate flags in QStyle::ControlElement for parts of QSlider.
maybe you should look at this: http://doc.qt.io/qt-4.8/stylesheet-examples.html#customizing-qslider
If I understand you correctly, you want a slider that changes not only its position but also its appearance as you slide, right? For example, a mix of QDial and QSlider, ie. a slider with a turning knob.
If so, you will need to subclass either QSlider or QAbstractSlider (or QDial) and do the painting in your own paintEvent(). Note, however, that you will loose all style-awareness unless you care about that yourself (and that is an interesting topic in itself, see http://doc.qt.io/qt-4.8/style-reference.html for more info).
The Qt demos and examples, or the QSlider/QDial source code itself may serve as examples on how to overload a paintEvent().

Set form size to fit the controls

I have a form that contains just a single PictureBox. I have a method that resizes the box to a given size, but the form stays the default 300x300. How do I resize the form to fit the box inside it? Surely there must be a better way than adding hardcoded title bar and margin widths to the PictureBox dimensions.
As far as I know, you can do so by enabling AutoSize (make it true), also keep an eye on the AutoSizeMode (perhaps it's better to set it to GrowAndShrink).
Hope that's useful.
The simple solution is to set the PictureBox::Dock property to Fill and change the form's ClientSize property. Which helps you get to the more efficient solution, no need to burn up a control when you can simply override the form's OnPaint() method and call e->Graphics->DrawImage().
Changing the form's AutoSize property to True works too. Set AutoSizeMode to GrowAndShrink to allow it to get smaller. And a MinimumSize would be advisable.
Beware that it is very unusual for programs to automatically change their window sizes. I can't think of a single program I commonly use that does this. The right way is to leave it up to the user to size and position the windows. Setting the AutoScroll property to True is now the right thing to do.