Animation MaxHeight

Could someone let me know how to animate how to increase the height of a button? I can increase the height of a button on the click of a button

Page {
    Container {
             Button {
                    id: btn2
                    text: "button2"

                    onClicked: {
                         btn1.maxHeight = 500
                         btn1.minHeight = 500
                    }
             }

             ImageButton {
                         id: btn1
                         defaultImageSource: "asset:///image.png"
             }
         }
   }

But how can I animate the button increase height?

Thank you

Chris

Sorry for the delay.

For animate any numerical property, you want that you should expose QPropertyAnimation to QML:

(1) include the following in your ApplicationUI.cpp

#include 
#include 

(2) in the before constructor ' QmlDocument * qml = QmlDocument::create (...) "expose to QML

qmlRegisterType("QPropertyAnimation", 1, 0, "QPropertyAnimation");
qmlRegisterUncreatableType("QPropertyAnimation", 1, 0, "QEasingCurve", "");

(3) and after (if you have not already)

qml->setContextProperty("_app", this);

(4) add the following two functions declared in the .h as Q_INVOKABLE

QByteArray ApplicationUI::qstringToQByteArray(QString str)
{
    return str.toAscii();
}
QEasingCurve ApplicationUI::easingCurve(int easing)
{
  return static_cast(easing);
}

(5) now in QML 'import QPropertyAnimation 1.0' and use as below

import QPropertyAnimation 1.0Page {    Container {
    attachedObjects: [
        QPropertyAnimation {
        id: itemAnimation
        startValue: 0
        endValue: 100
        duration: 2500
        easingCurve:  _app.easingCurve(QEasingCurve.OutElastic)
        targetObject: myContainer
        propertyName: _app.qstringToQByteArray("myProperty")
        onFinished: {
             console.log("ENDED");
        }
        }
    ]
    Container {
        id: myContainer
        property int myProperty: 0
        minHeight: myProperty
        maxHeight: myProperty
    }
    Button {
        onClick: itemAnimation.start();
    }    }
}

You can take a reference to the kinds of curves of acceleration here and here the QPropertAnimation

Tags: BlackBerry Developers

Similar Questions

  • Animation in a manager need to

    Hi all

    I want to give the animation in a Manager. I have a list, while clicking on the first line of this list it will add more than 3 lines below that, and when I click again in the same line that will remove these lines. I do that by addind and removing the Manager but I want to give the animation while addind or removing the Manager!

    Please suggest!

    Hi shivam.

    I got this code somewhere and I managed to change the code for the handler.
    Hope that this code will be useful for you...

    TestScreen.java

    package com.animationtest;
    
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.component.NullField;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class TestScreen extends MainScreen {
        private AnimatedManager _manager1,_manager2;
    
        public TestScreen() {
    
            VerticalFieldManager vfm =new VerticalFieldManager();
            vfm.add(new LabelField("labelField 1"));
            vfm.add(new ButtonField("buttonField 1"));
            vfm.add(new LabelField("labelField 2"));
            vfm.add(new ButtonField("buttonField 2"));
    
            _manager1=new AnimatedManager(vfm,true);
            add(_manager1);
    
            VerticalFieldManager vfm2 =new VerticalFieldManager();
            vfm2.add(new LabelField("labelField 3"));
            vfm2.add(new ButtonField("buttonField 3"));
            vfm2.add(new LabelField("labelField 4"));
            vfm2.add(new ButtonField("buttonField 4"));
    
            _manager2=new AnimatedManager(vfm2,false);
            add(_manager2);
        }
    
        protected void onUiEngineAttached(boolean attached) {
            super.onUiEngineAttached(attached);
    
            if (attached) {
                _manager1.startAnimation();
                _manager2.startAnimation();
            }
        }
    }
    

    AnimatedManager.java

    package com.animationtest;
    
    import net.rim.device.api.system.Application;
    import net.rim.device.api.system.Display;
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Manager;
    
    import com.animationtest.Animation.AnimationListener;
    
    public class AnimatedManager extends Manager implements AnimationListener {
        private final Animation _animation;
        private final int _duration = 1000;
        private boolean isFromTop;
        private volatile boolean _isAnimating;
    
        private Manager _field = new Manager(FIELD_HCENTER) {
            protected void sublayout(int width, int height) {
                setExtent(getPreferredWidth(), getPreferredHeight());
            }
        };
    
        private AnimatedField leftToRightAnimationManager = new AnimatedField() {
    
            private final int _sx = - Display.getWidth();
            private final Point _pos = new Point(_sx, 0);
            private final Point _dest = new Point(0 , 0);
    
            public void setField(Manager _manager) {
                _field=_manager;
            }
    
            public Point getCurrentPosition() {
                return _pos;
            }
    
            public Field getField() {
                return _field;
            }
    
            public void updatePosition(int time, int duration) {
                _pos.x = _sx + (_dest.x - _sx) * time / duration;
            }
        };
    
        private AnimatedField topToBottomAnimationManager = new AnimatedField() {
    
            private final int _sy = - Display.getHeight();
            private final Point _pos = new Point(0,_sy);
            private final Point _dest = new Point(0, 0);
    
            public void setField(Manager _manager) {
                _field=_manager;
            }
    
            public Point getCurrentPosition() {
                return _pos;
            }
            public Field getField() {
                return _field;
            }
            public void updatePosition(int time, int duration) {
                _pos.y = _sy + (_dest.y - _sy)  * time / duration;
            }
        };
    
        public AnimatedManager(Manager _manage, boolean _isFromTop) {
            super(USE_ALL_HEIGHT | USE_ALL_WIDTH);
            isFromTop=_isFromTop;
            _animation = new Animation(_duration);
            _animation.setListener(this);
    
            if(isFromTop){
                topToBottomAnimationManager.setField(_manage);
                add(topToBottomAnimationManager.getField());
            }
            else{
                leftToRightAnimationManager.setField(_manage);
                add(leftToRightAnimationManager.getField());
            }
        }
    
        public void startAnimation() {
            _isAnimating = true;
            _animation.start();
        }
    
        protected void sublayout(int maxwidth, int maxheight) {
            final int width = _field.getPreferredWidth();
            final int height = _field.getPreferredHeight();
            if(isFromTop)
                updateAnimation(topToBottomAnimationManager);
            else
                updateAnimation(leftToRightAnimationManager);
    
            setExtent(width, height);
        }
    
        private void updateAnimation(AnimatedField af) {
            Field f = af.getField();
            final int width = f.getPreferredWidth();
            final int height = f.getPreferredHeight();
    
            if (!_isAnimating) layoutChild(f, width, height);
            setPositionChild(f, af.getCurrentPosition().x, af.getCurrentPosition().y);
        }
    
        public int getPreferredHeight() {
            return _field.getPreferredHeight();
        }
    
        public int getPreferredWidth() {
            return _field.getPreferredWidth();
        }
    
        public void onNewFrame(int time) {
            if(isFromTop)
                topToBottomAnimationManager.updatePosition(time, _duration);
            else
                leftToRightAnimationManager.updatePosition(time, _duration);
            synchronized(Application.getEventLock()) {
                updateLayout();
                _isAnimating = time == _duration;
            }
        }
    }
    

    Animation.Java

    package com.animationtest;
    
    public class Animation {
        public static interface AnimationListener {
            void onNewFrame(int time);
        }
    
        private static final int DEFAULT_FPS = 40;
    
        private int _duration;
        private int _time;
        private int _fps = DEFAULT_FPS;
        private Thread _thread;
        private volatile boolean _running;
    
        private AnimationListener _listener;
    
        public Animation(int duration) {
            _duration = duration;
        }
    
        public void setFPS(int fps) {
            _fps = fps;
        }
    
        public int getFPS() {
            return _fps;
        }
    
        public void setDuration(int duration) {
            _duration = duration;
        }
    
        public int getDuration() {
            return _duration;
        }
    
        public int getTimeElapsed() {
            return _time;
        }
    
        public void setListener(AnimationListener l) {
            _listener = l;
        }
    
        public synchronized void start() {
            if (_thread == null) {
                _running = true;
                _thread = new Thread(new Runnable() {
                    public void run() {
    
                        final int idleTime = (1000 / _fps * 10 + 10) / 10;
                        final int duration = _duration;
                        _time = 0;
    
                        try {
                            while(_running && _time <= duration) {
                                animate(_time);
                                _time += idleTime;
    
                                Thread.sleep(idleTime);
                            }
    
                            if (_time - idleTime < duration) animate(duration);
    
                        } catch (InterruptedException e) {}
    
                        stop();
                    }
                });
    
                _thread.start();
            }
        }
    
        public synchronized void stop() {
    
            _running = false;
    
            if (_thread != null && _thread.isAlive()) {
                _thread.interrupt();
                _thread = null;
            }
        }
    
        private void animate(int time) {
            AnimationListener listener = _listener;
            if (listener != null) {
                listener.onNewFrame(time);
            }
    
        }
    }
    

    AnimatedField.java

    package com.animationtest;
    
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Manager;
    
    public interface AnimatedField {
    
        Field getField();
    
        void setField(Manager _manager);
    
        void updatePosition(int time, int duration);
    
        Point getCurrentPosition();
    }
    

    Point.Java

    package com.animationtest;
    
    public final class Point {
        public int x, y;
    
        public Point(int x, int y) {
            this.x = x;
            this.y = y;
        }
    }
    
  • How to make animated gifs to work in FCPX?

    Hello

    How to make animated gifs to work in FCPX?

    They work in FCP7 (FCS) but not FCPX. Strange.

    assailed

    Elmer

    If you had FCP7, you have Quicktime 7 Pro (upgraded automatically at installation FCP7). Check your Applications > Utilities folder.

    Open the gif in QT7 and export as... (Sequence Quicktime Movie > Open Options)... might as well go with ProRes LT and make sure that you pay attention to the size option (select current if the original is 100%).

  • Animation switching Office issues

    Does anyone else know a different animation in the Yosemite Sierra? Switching between desktop computers, the files animate as well and will be geek sometimes. Just curious, if it is a bug. I also have problems with the desktop image not resizing not between my Apple screen and the laptop, but one thing at a time. Thank you!

    Link to screenshot: https://www.dropbox.com/s/tl2bb1el5p4trs7/Full%20Screen%20Switching.mov?dl=0

    Hello SixThreeThree,

    Welcome to Apple Support communities. I see your message and your video as the glitch icons visually in the transition from desktop computers. I know it shouldn't. I'll be more than happy to help.

    Since it is a Visual problem, I recommend you to reset the NVRAM. This is the temporary video memory. Instructions that are below:

    How to reset the NVRAM on your Mac - Apple Support

    Once done, test to see if it happens again. If so, it wouldn't hurt to test this question on a new user. Take a look at this article:

    How to test a question in another account on your Mac - Apple Support

    Take care!

  • Old iPhone users - Animations in text?

    Just out of curiosity, older models of iPhone users can do the new animations and writing in the text? Also, if they update iOS can they see how iPhone users 7 may?

    I think that all 10 iOS devices support touch digital.

    Use number key on your iPhone, iPad and iPod touch - Apple Support

  • I have iOS 10 and I am still unable to make messages with animation effects. How can I solve this problem?

    I have iOS 10 and I am still unable to make messages with animation effects. How can I solve this problem?

    Without knowing what is happening when you try, it is difficult to recommend troubleshooting. However, one of the first steps is to ensure that you don't have to reduce the Motion activated in accessibility.

  • Why am I unable to send animation effects when I press and hold send key

    I have the ios10 update on my phone but when I hold down the Send button to add animations, little option to choose what I want will not appear in my messages nor can I receive the animation when someone sends me

    Disable the reduced movement.

    Settings > general > accessibility > reduce motion > [disable]

  • iPhone 7 slower Animations &amp; Chop?

    I use an iPhone 7, coming of the 6 s. I noticed that when an application is closed, there is a stutter that occurs about 80% of the time when you return to the home screen. On the 6s is one, smooth animation. I even recorded two screens in slow motion to make sure I wasn't crazy, and of course, the iPhone 7 stops just after that starts the animation. In addition, I noticed that using the task on the iPhone switch 7 is rougher. Even more, I noticed that unity apps are much more turbulent and unstable on the iPhone 7 when they are smooth as silk on the 6s. Has anyone else noticed similar experiences? I noticed lag on iPhone Home screen a friend 7 at work, and I've seen other people mention the same thing. I just want to get this out there while Apple is aware. (If they are not already.) And, Yes, I already wrote a request for feedback. Just want to get more visibility in the present, or if someone has found solutions.

    We could do with as many people as possible put your comments in on this one. I was in the Apple Store the other day, trying to attract the attention of the assistant to this problem; He couldn't see it. I know I'm picky, but I can really see it.

    The only solution I've seen involves reducing transparency and movement in accessibility options. They have some workarounds, however.

  • View seeks to create graphic animations in the videos, the FCPX is capable?

    Hello useful community! A two-part question.

    I'm just getting started on the video production and have some needs in mind. I hope you can let me know if FCPX can do that hopefully, if there is an obvious solution, I am missing, or some of you approach use.

    I'll be doing a few videos of interview style and will have several camera angles, with that I need to work. So if I understand correctly to work with iMovie, I'll have a main video timeline and then 'cut' in and out secondary structures for the other angles. But I must have a logo sitting in the corner as well. Is there still enough chronologies to cut in different camera angles while having a timeline showing the stationary chart? iMovie does not you have only your primary and another calendar cut in and out, but I hope that FCPX has the ability to overlay 2 more than at a time? Or maybe I'm going about this the wrong way need?

    The second part is linked, I want to be the logo/text animation because it is (as a brief introduction). Not throughout the entire video or something extremely complex, but to animate shapes and text sliding in such that the name of the speaker, the name of show graphics, etc... And I'm hoping to create my own custom animations, not the familiar "motions of text" located in iMovie. I feel like the examples I found online that all look like they have animations the same model and I hope for much more creative in this area occasionally, if that makes sense. In its most simple example I guess, the design and animation capabilities/techniques you can do in Keynote for graphics/text that can be market timed, fades, slides, etc.

    Is FCPX the right program to incorporate more complex forms of text animations as well? Or is it the work of another software?

    I hope that makes sense. Any help is appreciated, thanks!

    Mark

    TYou can have an unlimited number of video layers.

    Yes, you can make custom animations. For more complex animations, you use Motion.

  • shift iPhone animation 7...

    Just took my 7 32 GB iPhone... Noticed a lagg when opening and closing an application for the first time.

    When I press the home button and reopen all the app goes smooth...
    Already talked to Apple support, they suggested to restore to the factory with IOS 10.0.1 and does not restore any backups.
    Just did that, still lagg...  Little disappointed, my iPhone 6 is smoother...

    Someone else this issue? Must be! Check it out really well, I think that this is gonne be reported a lot!

    I have a similar but slightly different problem on my iPhone 7. Every time I close an app, the animation lags badly and it's annoying. All other animations, including the opening animation app, are very good. I have initially restored from a backup, but I tried to restore normal settings, and it made no difference. My iPhone 5 has no problem of lag during the opening and closing of 10 iOS apps.

  • The animation is pixelated when exporting

    Hi all, I am a novice user FCPX and I just edited a 6 minute together animation.

    I exported using the following parameters, but the quality is very bad. I'm doing something wrong here?

    It does not take that long to make which makes me wonder if it is compressing somehow?

    This seems OK, but can not say without seeing the original exit or what you do. How to watch videos within FCP?

  • Kanji animation does not

    The site is http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?
    (They also have alternative URLS but the animation doesn't always work.)

    An example would be http://www.csse.monash.edu.au/~jwb/cgi-bin/wwwjdic.cgi?163568_%C5%EC

    I use Windows 7 Pro. Firefox 38.0.5. (Everything worked fine before this last update).
    Not this problem when I use Google Chrome.
    I disabled all the modules etc. Closed and restarted Windows 7 several times.
    Nothing helps. I install a fresh copy full of FF 38.0.5 on a new folder with the new name, but it has integrated all the old content. I guess you should completely remove the existing copy and then manually insert inserts the bookmarks, modules etc. from recorded files. Too risky and complicated for this old geezer.

    Any ideas on how to solve this problem? Much obliged.

    Make sure the image.animation_mode pref isn't the value none, but at least once or normal.

    You can open the topic: config page via the address bar.
    You can accept the warning and click on "I'll be careful" to continue.

  • composite reflectivity loop (animated weather radar image) does not work in Firefox.

    Just switched from XP to Windows 7 Pro. Installed Firefox. When you try to view a loop of composite reflectivity (animated weather radar image) on the site of the National Weather Service, I get an error message that a plug-in is missing, but no further details.

    Thank you

    Ed

    These are the most common in Firefox you can try:

    Update your plugins to the latest version. Make sure you are aware:

    If you see problems see also:

  • How do I configure firefox to open a gif animated in outlook 2010 - it's just 'new tab' s on

    After changing the associations .mht, and .mhtml for firefox (from IE), when I click on a gif image animated in an e-mail message and select "Open in browser", firefox opens, then just "tabs" away (as is the opening each frame separately). How can I get firefox to display the animation as IE used to?

    An add-in to open the type of file may help: https://addons.mozilla.org/en-us/fire.../mht

  • GIF animated signature mail (mac vs PC)

    I made a signature with an animated gif. It works fine in mac to mac. But the PC can't see it. I actually put the gif online and linked to it in my email signature, so that could be the problem. But the advantage of this is that the mail does not seem to have an attachment. I'd love to make it work on the PC too. Any suggestions?

    (El Capitan, Apple Mail)

    How email is displayed depends on how the recipient has configured his email client. If you send me the email containing the gif animated in the signature I would not see it no more. Several mail users configure their e-mail client to not display images, because images can contain a web tracking bugs/tags.

Maybe you are looking for

  • Libretto W100 - switching language from German to English

    HelloI bought the German version of the Libretto w100 (10 d) to get a sim - 3 G slot. Despite what the salesperson told me, it is not possible to switch from German into English interface. I have since bought an upgrade (Windows Anytime) Win7 Home to

  • Ethernet and PCI Simple Communications Controller Drivermissing controller driver

    Hello I recently installed Windows 7 Ultimate on my desktop Hp Pro 3500 Series MT, but I can't the right Ethernet controller driver and the driver PCI Simple Communications controller from the internet. The Hardware IDS are as follows: Ethernet contr

  • Tecra M11 - very low audio volume

    I have a Tecra M11 for a few months and I am overall very happy with my new laptop. A question I have is the speaker volume level. When I play the video or the sound of music is about audible, even with the speakers lining and the relevant channels a

  • HP Pavilion dv7-3131ez: drivers

    I'm looking for the latest drivers for my pc. where can I download them?

  • ON WINDOWS HP SYSTEM RESTORE

    Any restore point I want to go back on the application of SYSTEM RESTORE, a RESTORATION INCOMPLETE window appears on the screen after trying to adopt this procedure Hail Mary.