Java Code Examples for org.jdesktop.animation.timing.Animator#start()

The following examples show how to use org.jdesktop.animation.timing.Animator#start() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Stacker.java    From littleluck with Apache License 2.0 6 votes vote down vote up
/**
 * Fades out and removes the current message component
 */
public void hideMessageLayer() {
    if (messageLayer != null && messageLayer.isShowing()) {
        Animator animator = new Animator(500,
                new PropertySetter(messageAlpha, "alpha", messageAlpha.getAlpha(), 0.0f) {
                    public void end() {
                        remove(messageLayer);
                        revalidate();
                    }
                });
        animator.setStartDelay(300);
        animator.setAcceleration(.2f);
        animator.setDeceleration(.5f);
        animator.start();
    }
}
 
Example 2
Source File: Stacker.java    From Darcula with Apache License 2.0 6 votes vote down vote up
/**
 * Fades out and removes the current message component
 */
public void hideMessageLayer() {
    if (messageLayer != null && messageLayer.isShowing()) {
        Animator animator = new Animator(500,
                new PropertySetter(messageAlpha, "alpha", messageAlpha.getAlpha(), 0.0f) {
                    public void end() {
                        remove(messageLayer);
                        revalidate();
                    }
                });
        animator.setStartDelay(300);
        animator.setAcceleration(.2f);
        animator.setDeceleration(.5f);
        animator.start();
    }
}
 
Example 3
Source File: AnimatingSplitPane.java    From littleluck with Apache License 2.0 6 votes vote down vote up
public void setExpanded(boolean expanded) {
    if (expanded != firstExpanded) {
        
        if (!firstExpanded) {
            lastDividerLocation = getDividerLocation();
        }
        
        this.firstExpanded = expanded;

        Animator animator = new Animator(500, new PropertySetter(this, "dividerLocation",
               getDividerLocation(), (expanded? getHeight() : lastDividerLocation)));
        
        animator.setStartDelay(10);
        animator.setAcceleration(.2f);
        animator.setDeceleration(.3f);
        animator.start();            
    }
}
 
Example 4
Source File: Stacker.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
/**
 * Fades out and removes the current message component
 */
public void hideMessageLayer() {
    if (messageLayer != null && messageLayer.isShowing()) {
        Animator animator = new Animator(500,
                new PropertySetter(messageAlpha, "alpha", messageAlpha.getAlpha(), 0.0f) {
                    public void end() {
                        remove(messageLayer);
                        revalidate();
                    }
                });
        animator.setStartDelay(300);
        animator.setAcceleration(.2f);
        animator.setDeceleration(.5f);
        animator.start();
    }
}
 
Example 5
Source File: AnimatingSplitPane.java    From beautyeye with Apache License 2.0 6 votes vote down vote up
public void setExpanded(boolean expanded) {
    if (expanded != firstExpanded) {
        
        if (!firstExpanded) {
            lastDividerLocation = getDividerLocation();
        }
        
        this.firstExpanded = expanded;

        Animator animator = new Animator(500, new PropertySetter(this, "dividerLocation",
               getDividerLocation(), (expanded? getHeight() : lastDividerLocation)));
        
        animator.setStartDelay(10);
        animator.setAcceleration(.2f);
        animator.setDeceleration(.3f);
        animator.start();            
    }
}
 
Example 6
Source File: FadingDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public static void setTextAndAnimate(final JTextComponent textComponent,
        final String text) {
   Color c = textComponent.getForeground();

   KeyFrames keyFrames = new KeyFrames(KeyValues.create(
               new Color(c.getRed(), c.getGreen(), c.getBlue(), 255),
               new Color(c.getRed(), c.getGreen(), c.getBlue(), 0),
               new Color(c.getRed(), c.getGreen(), c.getBlue(), 255)
           ));
   PropertySetter setter = new PropertySetter(textComponent, "foreground",
           keyFrames);

   Animator animator = new Animator(200, setter);
   animator.addTarget(new TimingTargetAdapter() {
       private boolean textSet = false;

       public void timingEvent(float fraction) {
           if (fraction >= 0.5f && !textSet) {
               textComponent.setText(text);
               textSet = true;
           }
       } 
   });
   animator.start();
}
 
Example 7
Source File: PulseFieldDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private JComponent buildPulsatingField() {
    JTextField field = new JTextField(20);
    
    PulsatingBorder border = new PulsatingBorder(field);
    field.setBorder(new CompoundBorder(field.getBorder(), border));
    
    PropertySetter setter = new PropertySetter(
            border, "thickness", 0.0f, 1.0f);
    Animator animator = new Animator(900, Animator.INFINITE,
            Animator.RepeatBehavior.REVERSE, setter);
    animator.start();
    
    JPanel panel = new JPanel(new FlowLayout());
    panel.add(field);
    panel.add(new JButton("OK"));
    panel.add(new JButton("Cancel"));
    return panel;
}
 
Example 8
Source File: DiscreteInterpolation.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String[] args) {
    KeyValues keyValues = KeyValues.create(2, 6, 3, 5, 4);
    KeyFrames keyFrames = new KeyFrames(keyValues,
            DiscreteInterpolator.getInstance());
    Animator anim = PropertySetter.createAnimator(1000, 
            new DiscreteInterpolation(), "intValue", keyFrames);
    anim.start();
    
}
 
Example 9
Source File: PulseDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void startAnimator() {
    PropertySetter setter = new PropertySetter(this, "alpha", 0.0f, 1.0f);
    Animator animator = new Animator(600, Animator.INFINITE,
            Animator.RepeatBehavior.REVERSE, setter);
    animator.start();
}
 
Example 10
Source File: SpringDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void showSpring(Rectangle bounds, Image image) {
    this.bounds = bounds;
    this.image = image;
    
    Animator animator = PropertySetter.createAnimator(250, this,
            "zoom", 0.0f, 1.0f);
    animator.setAcceleration(0.2f);
    animator.setDeceleration(0.4f);
    animator.start();
    
    repaint();
}
 
Example 11
Source File: FadingDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void previous() {
    Animator animator = new Animator(1000);
    animator.addTarget(new PropertySetter(this, "alpha", 0.0f));
    animator.setAcceleration(0.2f);
    animator.setDeceleration(0.4f);
    animator.start();
}
 
Example 12
Source File: FadingDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void next() {
    Animator animator = new Animator(1000);
    animator.addTarget(new PropertySetter(this, "alpha", 1.0f));
    animator.setAcceleration(0.2f);
    animator.setDeceleration(0.4f);
    animator.start();
}
 
Example 13
Source File: IntroPanel.java    From Darcula with Apache License 2.0 5 votes vote down vote up
public void slideTextOut() {
    Animator animator = new Animator(600, 
            new PropertySetter(introText, "x", introText.getX(), -introText.getWidth()));
    animator.setStartDelay(10);
    animator.setAcceleration(.5f);
    animator.setDeceleration(.2f);
    animator.start();        
}
 
Example 14
Source File: MorphingDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void next() {
    Animator animator = new Animator(500);
    animator.addTarget(new PropertySetter(this, "alpha", 1.0f));
    animator.setAcceleration(0.2f);
    animator.setDeceleration(0.4f);
    animator.start();
}
 
Example 15
Source File: SplineInterpolatorTest.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void main(String args[]) {
    Animator animator = 
            new Animator(DURATION, new SplineInterpolatorTest());
    SplineInterpolator interpolator = new SplineInterpolator(1f, 0f, 0f, 1f);
    animator.setInterpolator(interpolator);
    // Note that you could get similar behavior by setting the following
    // acceleration/deceleration properties instead of the interpolator
    // above:
    //animator.setAcceleration(.5f);
    //animator.setDeceleration(.5f);
    animator.setStartDelay(1000);
    animator.setResolution(DURATION / 10);
    animator.start();
}
 
Example 16
Source File: IntroPanel.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
public void slideTextIn() {
    Animator animator = new Animator(800, 
            new PropertySetter(introText, "x", getWidth(), 30));
    animator.setStartDelay(800);
    animator.setAcceleration(.2f);
    animator.setDeceleration(.5f);
    animator.start();
}
 
Example 17
Source File: DemoPanel.java    From beautyeye with Apache License 2.0 5 votes vote down vote up
public DemoPanel(Demo demo) {
    this.demo = demo;
    setLayout(new BorderLayout());
    // remind(aim): how to access resourceMap?
    //resourceMap = getContext().getResourceMap();

    LoadAnimationPanel loadAnimationPanel = new LoadAnimationPanel();

    add(loadAnimationPanel);
    loadAnimationPanel.setAnimating(true);

    LoadedDemoPanel demoPanel = new LoadedDemoPanel(demo);

    try {
        loadAnimationPanel.setAnimating(false);
        Animator fadeOutAnimator = new Animator(400,
                new FadeOut(DemoPanel.this,
                        loadAnimationPanel, demoPanel));
        fadeOutAnimator.setAcceleration(.2f);
        fadeOutAnimator.setDeceleration(.3f);
        Animator fadeInAnimator = new Animator(400,
                new PropertySetter(DemoPanel.this, "alpha", 0.3f, 1.0f));
        TimingTrigger.addTrigger(fadeOutAnimator, fadeInAnimator, TimingTriggerEvent.STOP);
        fadeOutAnimator.start();
    } catch (Exception ignore) {
        System.err.println(ignore);
        ignore.printStackTrace();
    }
}
 
Example 18
Source File: IntroPanel.java    From littleluck with Apache License 2.0 5 votes vote down vote up
public void slideTextOut() {
    Animator animator = new Animator(600, 
            new PropertySetter(introText, "x", introText.getX(), -introText.getWidth()));
    animator.setStartDelay(10);
    animator.setAcceleration(.5f);
    animator.setDeceleration(.2f);
    animator.start();        
}
 
Example 19
Source File: DemoPanel.java    From Darcula with Apache License 2.0 5 votes vote down vote up
public DemoPanel(Demo demo) {
    this.demo = demo;
    setLayout(new BorderLayout());
    // remind(aim): how to access resourceMap?
    //resourceMap = getContext().getResourceMap();

    LoadAnimationPanel loadAnimationPanel = new LoadAnimationPanel();

    add(loadAnimationPanel);
    loadAnimationPanel.setAnimating(true);

    LoadedDemoPanel demoPanel = new LoadedDemoPanel(demo);

    try {
        loadAnimationPanel.setAnimating(false);
        Animator fadeOutAnimator = new Animator(400,
                new FadeOut(DemoPanel.this,
                        loadAnimationPanel, demoPanel));
        fadeOutAnimator.setAcceleration(.2f);
        fadeOutAnimator.setDeceleration(.3f);
        Animator fadeInAnimator = new Animator(400,
                new PropertySetter(DemoPanel.this, "alpha", 0.3f, 1.0f));
        TimingTrigger.addTrigger(fadeOutAnimator, fadeInAnimator, TimingTriggerEvent.STOP);
        fadeOutAnimator.start();
    } catch (Exception ignore) {
        System.err.println(ignore);
        ignore.printStackTrace();
    }
}
 
Example 20
Source File: MyIntAnimPS.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public MyIntAnimPS() {
    // Set up the animation
    Animator anim = PropertySetter.createAnimator(1000, 
            this, "myInt", 0, 10);
    anim.start();
}