# Show PopupMenu animated?

**URL:** <https://forum.juce.com/t/show-popupmenu-animated/30931>\
**Category:** General JUCE discussion\
**Created:** [December 18, 2018, 8:31pm UTC](https://forum.juce.com/t/show-popupmenu-animated/30931 "2018-12-18T20:31:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![gavinburke](https://avatars.discourse-cdn.com/v4/letter/g/e19adc/32.png) [@gavinburke](https://forum.juce.com/u/gavinburke)\
**Post date:** [December 18, 2018, 8:31pm UTC](https://forum.juce.com/t/show-popupmenu-animated/30931/1 "2018-12-18T20:31:03Z")

</div>

We’re adding some final polish to a plug-in and are trying to find a way to show PopupMenus animated.

Is there anyway to get a handle on a PopupMenu’s MenuWindow component? The only place where I can see it is possible is in the Lnf method “preparePopupMenuWindow”

Any help in figuring out how to show PopupMenus animated without it turning into a hack-a-thon would be much appreciated!

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [December 19, 2018, 9:59am UTC](https://forum.juce.com/t/show-popupmenu-animated/30931/2 "2018-12-19T09:59:02Z")

</div>

Something like this? (warning: untested)

```auto
/ *******************************************************************************
 The block below describes the properties of this PIP. A PIP is a short snippet
 of code that can be read by the Projucer and used to generate a JUCE project.

 BEGIN_JUCE_PIP_METADATA

  name: AnimatedPopupMenu

  dependencies: juce_core, juce_data_structures, juce_events, juce_graphics, juce_gui_basics
  exporters: xcode_mac

  moduleFlags: JUCE_STRICT_REFCOUNTEDPOINTER=1

  type: Component
  mainClass: MyComponent

 END_JUCE_PIP_METADATA

******************************************************************************* /

#pragma once

//==============================================================================
class MyComponent : public Component
{
public:
    //==============================================================================
    MyComponent()
    {
        addAndMakeVisible (showPopupButton);
        
        showPopupButton.onClick = [this]
        {
            PopupMenu m;
            
            for (int i = 1; i <= 10; ++i)
                m.addItem (i, "Item " + String (i));
            
            m.setLookAndFeel (&lf);
            m.showMenu (PopupMenu::Options().withParentComponent (this));
        };
        
        setSize (600, 400);
    }

    ~MyComponent()
    {
    }

    //==============================================================================
    void paint (Graphics& g) override
    {
        g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId));
    }

    void resized() override
    {
        showPopupButton.centreWithSize (250, 35);
    }

private:
    //==============================================================================
    TextButton showPopupButton { "Show popup" };
    
    struct PopupLF : public LookAndFeel_V4
    {
        void preparePopupMenuWindow (Component& menu)
        {
            Desktop::getInstance().getAnimator().fadeIn (&menu, 1000);
        }
    };
    
    PopupLF lf;

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MyComponent)
};

```

---

<div class="post-metadata">

**Author:** ![gavinburke](https://avatars.discourse-cdn.com/v4/letter/g/e19adc/32.png) [@gavinburke](https://forum.juce.com/u/gavinburke)\
**Post date:** [December 19, 2018, 11:57pm UTC](https://forum.juce.com/t/show-popupmenu-animated/30931/3 "2018-12-19T23:57:16Z")

</div>

Works great Ed!

---

<div class="post-metadata">

**Author:** ![mercuriall](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@mercuriall](https://forum.juce.com/u/mercuriall)\
**Post date:** [October 23, 2020, 2:04pm UTC](https://forum.juce.com/t/show-popupmenu-animated/30931/4 "2020-10-23T14:04:47Z")

</div>

On Big Sur, the menu appears without a shadow. Is there some correct way to keep the shadow when animating?

 ![Снимок экрана 2020-10-23 в 16.07.50](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/a/a103783c094ecf75fbeb48c5ef64efc2a295b230.jpeg) ![Снимок экрана 2020-10-23 в 16.08.39](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/8/85a957214b7165d77bb4b0a9be8693ec5f0d4803.jpeg)
