org.jdesktop.animation.timing.interpolation.PropertySetter Java Examples

The following examples show how to use org.jdesktop.animation.timing.interpolation.PropertySetter. 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: ClearFilterLabel.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void reanimate() {

		if (!AnimationUtils.isAnimationEnabled()) {
			transparency = FULLY_OPAQUE;
			return;
		}

		if (animator != null) {
			return; // already animating
		}

		animator = PropertySetter.createAnimator(FADE_IN_MS, this, "transparency",
			FULLY_TRANSPARENT, FULLY_OPAQUE);
		animator.setAcceleration(0f);
		animator.setDeceleration(0.8f);

		animator.addTarget(new TimingTargetAdapter() {
			@Override
			public void end() {
				animator = null;
			}
		});

		animator.start();
	}
 
Example #2
Source File: AnimatingSplitPane.java    From Darcula 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 #3
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 #4
Source File: SpherePanel.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Load the named image and create the animator that will bounce the 
 * image down and back up in this panel.
 */
SpherePanel(String filename) {
    try {
        URL url = getClass().getResource("images/" + filename);
        sphereImage = ImageIO.read(url);
    } catch (Exception e) {
        System.out.println("Problem loading image " + filename + ": " + e);
        return;
    }
    setPreferredSize(new Dimension(sphereImage.getWidth() + 2 * PADDING, 
            PANEL_HEIGHT));
    bouncer = PropertySetter.createAnimator(2000, this, "sphereY",
            0, (PANEL_HEIGHT - sphereImage.getHeight()), 0);
    bouncer.setAcceleration(.5f);
    bouncer.setDeceleration(.5f);
}
 
Example #5
Source File: MotionDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void configureAnimations() {
    Animator leftAnimator = new Animator(200);
    leftAnimator.setAcceleration(0.3f);
    leftAnimator.setDeceleration(0.2f);
    leftAnimator.addTarget(new PropertySetter(
            saveButton, "location", new Point(16, 16)));
    leftAnimator.addTarget(new PropertySetter(
            openButton, "location", new Point(16, openButton.getY())));
    leftAnimator.addTarget(new PropertySetter(
            textArea, "location",
            new Point(16 + saveButton.getWidth() + 6, 16)));
    
    ActionTrigger.addTrigger(leftLayoutButton, leftAnimator);
    
    Animator rightAnimator = new Animator(200);
    rightAnimator.setAcceleration(0.3f);
    rightAnimator.setDeceleration(0.2f);
    rightAnimator.addTarget(new PropertySetter(
            saveButton, "location", saveButton.getLocation()));
    rightAnimator.addTarget(new PropertySetter(
            openButton, "location", openButton.getLocation()));
    rightAnimator.addTarget(new PropertySetter(
            textArea, "location", textArea.getLocation()));
    
    ActionTrigger.addTrigger(rightLayoutButton, rightAnimator);
}
 
Example #6
Source File: FadingDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private HelpGlassPane() {
    try {
        helpImage = GraphicsUtilities.loadCompatibleImage(
                getClass().getResource("images/help.png"));
    } catch (IOException ex) {
        ex.printStackTrace();
    }
    addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            Animator animator = new Animator(200);
            animator.addTarget(new PropertySetter(
                    HelpGlassPane.this, "alpha", 0.0f));
            animator.setAcceleration(0.2f);
            animator.setDeceleration(0.4f);
            animator.start();
        }
    });
}
 
Example #7
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 #8
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 #9
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 #10
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 #11
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 #12
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 #13
Source File: SplitVertexFunctionGraphJob.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
protected Animator createAnimator() {
	// don't paint these vertices initially
	parentVertex.setAlpha(0D);
	childVertex.setAlpha(0D);

	initializeVertexLocations();

	if (!useAnimation) {
		return null;
	}

	updateOpacity(0);

	Animator newAnimator =
		PropertySetter.createAnimator(DURATION, this, "percentComplete", 0.0, 1.0);
	newAnimator.setAcceleration(0f);
	newAnimator.setDeceleration(0.8f);

	return newAnimator;
}
 
Example #14
Source File: MoveImageRunner.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Changes the bounds of the given painter over a period of time
 * 
 * @param ghidraGlassPane The glass pane we are using to paint
 * @param startBounds The start position and size
 * @param endBounds The end position and size
 * @param painter The painter upon which we will update bounds
 * @param repaint true signals to repaint as the changes are made.  This can lead to 
 *        choppiness when using other animators in conjunction with the one used by this
 *        class.
 */
public MoveImageRunner( GGlassPane ghidraGlassPane, Rectangle startBounds, 
        Rectangle endBounds, ZoomedImagePainter painter, boolean repaint ) {
    this.dockingGlassPane = ghidraGlassPane;
    
    // changes the 'containerBounds' field on the painter via the setters/getters
    // note: a smaller duration here allows more location changing to be painted
    animator = PropertySetter.createAnimator( 200, painter, 
        "targetBounds", startBounds, endBounds );
    animator.setAcceleration( 0.2f );
    animator.setDeceleration( 0.4f );

    if ( repaint ) {
        animator.addTarget( new TimingTargetAdapter() {
            @Override
            public void end() {
                dockingGlassPane.repaint();
            }

            @Override
            public void timingEvent( float fraction ) {
                dockingGlassPane.repaint();
            }
        });
    }
}
 
Example #15
Source File: AbstractGraphVisibilityTransitionJob.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
protected Animator createAnimator() {

	if (!useAnimation) {
		return null;
	}

	updateOpacity(0);

	Animator newAnimator =
		PropertySetter.createAnimator(duration, this, "percentComplete", 0.0, 1.0);
	newAnimator.setAcceleration(0f);
	newAnimator.setDeceleration(0.8f);

	return newAnimator;
}
 
Example #16
Source File: AnimationUtils.java    From ghidra with Apache License 2.0 6 votes vote down vote up
RotateDriver(GGlassPane glassPane, Component component) {
	rotatePainter = new RotatePainter(component);
	this.glassPane = glassPane;

	double start = 0;
	double max = 1;
	animator = PropertySetter.createAnimator(1000, this, "percentComplete", start, max);

	animator.setAcceleration(0.2f);
	animator.setDeceleration(0.8f);

	animator.addTarget(new TimingTargetAdapter() {
		@Override
		public void end() {
			done();
		}
	});

	glassPane.addPainter(rotatePainter);

	animator.start();
}
 
Example #17
Source File: AnimationUtils.java    From ghidra with Apache License 2.0 6 votes vote down vote up
ShakeDriver(GGlassPane glassPane, Component component) {
	shakePainter = new ShakePainter(component);
	this.glassPane = glassPane;

	double emphasis = 1;
	animator = PropertySetter.createAnimator(425, this, "emphasis", 1.0, emphasis, 1.0);

	animator.setAcceleration(0.2f);
	animator.setDeceleration(0.8f);
	animator.setRepeatCount(2); // non-focus->focus; focus->non-focus (*2)

	animator.setRepeatBehavior(RepeatBehavior.REVERSE);

	animator.addTarget(new TimingTargetAdapter() {
		@Override
		public void end() {
			done();
		}
	});

	glassPane.addPainter(shakePainter);

	animator.start();
}
 
Example #18
Source File: GenericHeader.java    From ghidra with Apache License 2.0 6 votes vote down vote up
TitleFlasher() {
			animator = PropertySetter.createAnimator(1000, this, "color", NON_FOCUS_START_COLOR,
				NON_FOCUS_START_COLOR, Color.YELLOW, FOCUS_START_COLOR);

//			animator =
//				PropertySetter.createAnimator(1000, this, "color", NON_FOCUS_START_COLOR,
//					NON_FOCUS_START_COLOR, Color.YELLOW, FOCUS_START_COLOR);

			animator.setAcceleration(0.2f);
			animator.setDeceleration(0.8f);
//			animator.setRepeatCount(5); // non-focus->focus; focus->non-focus (*2)

			// color-to-color, reversing colors each time it is run
			animator.setRepeatBehavior(RepeatBehavior.REVERSE);

			animator.addTarget(new TimingTargetAdapter() {
				@Override
				public void end() {
					done();
				}
			});

			animator.start();

			titlePanel.setSelected(true);
		}
 
Example #19
Source File: AnimationUtils.java    From ghidra with Apache License 2.0 6 votes vote down vote up
protected BasicAnimationDriver(GGlassPane glassPane, BasicAnimationPainter painter) {
	this.glassPane = glassPane;
	this.painter = painter;

	double start = 0;
	double max = 1.0;

	animator = PropertySetter.createAnimator(2000, this, "percentComplete", start, max);

	animator.setAcceleration(0.2f);
	animator.setDeceleration(0.8f);
	animator.addTarget(new TimingTargetAdapter() {
		@Override
		public void end() {
			done();
		}
	});

	glassPane.addPainter(painter);

	animator.start();
}
 
Example #20
Source File: AnimationUtils.java    From ghidra with Apache License 2.0 6 votes vote down vote up
PointToComponentDriver(GGlassPane glassPane, Component fromComponent,
		Component toComponent) {
	this.glassPane = glassPane;

	painter =
		new PointToComponentPainter(getStartPointFromComponent(fromComponent), toComponent);

	double start = 0;
	double max = 1.0;
	animator = PropertySetter.createAnimator(500, this, "percentComplete", start, max);

	animator.setAcceleration(0.2f);
	animator.setDeceleration(0.8f);
	animator.addTarget(new TimingTargetAdapter() {
		@Override
		public void end() {
			done();
		}
	});

	glassPane.addPainter(painter);

	animator.start();
}
 
Example #21
Source File: AnimationUtils.java    From ghidra with Apache License 2.0 6 votes vote down vote up
SwingAnimationCallbackDriver(SwingAnimationCallback swingCallback, int duration) {
	this.callback = swingCallback;
	double start = 0;
	double max = 1.0;

	if (!animationEnabled) {
		// no animation; signal to just do the work
		callback.done();
		return;
	}

	animator = PropertySetter.createAnimator(duration, this, "percentComplete", start, max);

	animator.setAcceleration(0.2f);
	animator.setDeceleration(0.8f);
	animator.addTarget(new TimingTargetAdapter() {
		@Override
		public void end() {
			callback.done();
		}
	});

	animator.start();
}
 
Example #22
Source File: RelayoutFunctionGraphJob.java    From ghidra with Apache License 2.0 6 votes vote down vote up
@Override
protected Animator createAnimator() {

	initializeVertexLocations();
	clearLocationCache();

	if (!useAnimation) {
		return null;
	}

	updateOpacity(0);

	Animator newAnimator =
		PropertySetter.createAnimator(duration, this, "percentComplete", 0.0, 1.0);
	newAnimator.setAcceleration(0f);
	newAnimator.setDeceleration(0.8f);

	return newAnimator;
}
 
Example #23
Source File: AnimationUtils.java    From ghidra with Apache License 2.0 6 votes vote down vote up
FocusDriver(GGlassPane glassPane, Component component) {
	this.glassPane = glassPane;

	double start = 0;
	double max = .5;
	this.painter = new FocusPainter(component, max);

	animator = PropertySetter.createAnimator(1000, this, "percentComplete", start, max, max,
		max, max, max, start);

	animator.setAcceleration(0.2f);
	animator.setDeceleration(0.8f);
	animator.addTarget(new TimingTargetAdapter() {
		@Override
		public void end() {
			done();
		}
	});

	glassPane.addPainter(painter);

	animator.start();
}
 
Example #24
Source File: AnimationUtils.java    From ghidra with Apache License 2.0 6 votes vote down vote up
DragonImageDriver(Component component) {

			glassPane = AnimationUtils.getGlassPane(component);
			rotatePainter = new DragonImagePainter(component);

			double start = 0;
			double max = 1;
			int duration = 1500;
			animator =
				PropertySetter.createAnimator(duration, this, "percentComplete", start, max, start);

			animator.setAcceleration(0.2f);
			animator.setDeceleration(0.8f);

			animator.addTarget(new TimingTargetAdapter() {
				@Override
				public void end() {
					done();
				}
			});

			glassPane.addPainter(rotatePainter);

			animator.start();
		}
 
Example #25
Source File: SetterRace.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Creates a new instance of BasicRace */
public SetterRace(String appName) {
    RaceGUI basicGUI = new RaceGUI(appName);
    
    // Now set up an animation that will automatically
    // run itself with PropertySetter
    timer = PropertySetter.createAnimator(RACE_TIME, basicGUI.getTrack(), 
            "carPosition", TrackView.START_POS, TrackView.FIRST_TURN_START);
    basicGUI.getControlPanel().addListener(this);
}
 
Example #26
Source File: MorphingDemo.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(500);
    animator.addTarget(new PropertySetter(this, "alpha", 0.0f));
    animator.setAcceleration(0.2f);
    animator.setDeceleration(0.4f);
    animator.start();
}
 
Example #27
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 #28
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 #29
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 #30
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();
}