Java Code Examples for org.jdesktop.animation.timing.interpolation.PropertySetter#createAnimator()

The following examples show how to use org.jdesktop.animation.timing.interpolation.PropertySetter#createAnimator() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
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 12
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 13
Source File: AnimationUtils.java    From ghidra with Apache License 2.0 5 votes vote down vote up
PulseDriver(GGlassPane glassPane, Component component, boolean shake, int pulseCount) {

			pulsePainter =
				shake ? new PulseAndShakePainter(component) : new PulsePainter(component);

			this.glassPane = glassPane;

			// TODO allow for greater emphasis
			double emphasis = 1.75;

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

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

			animator.setRepeatBehavior(RepeatBehavior.REVERSE);

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

			glassPane.addPainter(pulsePainter);

			animator.start();
		}
 
Example 14
Source File: DockableHeader.java    From ghidra with Apache License 2.0 5 votes vote down vote up
EmphasizeDockableComponentAnimationDriver(Component component, Set<Component> others) {

			glassPane = AnimationUtils.getGlassPane(component);
			rotatePainter = new EmphasizeDockableComponentPainter(component, others);

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

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

			animator.setRepeatCount(2);
			animator.setRepeatBehavior(RepeatBehavior.REVERSE);

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

			glassPane.addPainter(rotatePainter);

			animator.start();
		}
 
Example 15
Source File: MorphingDemo.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void setupTriggers() {
    Animator animator = PropertySetter.createAnimator(
            150, this, "morphing", 0.0f, 1.0f);
    animator.setAcceleration(0.2f);
    animator.setDeceleration(0.3f);
    MouseTrigger.addTrigger(this, animator, MouseTriggerEvent.ENTER, true);
}
 
Example 16
Source File: TwinkleVertexAnimator.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected Animator createAnimator() {
	if (!useAnimation) {
		return null;
	}

	startEmphasis = vertex.getEmphasis();

	Animator newAnimator = PropertySetter.createAnimator(500, this, "currentEmphasis", 0.0, .5);
	newAnimator.setAcceleration(0.0f);
	newAnimator.setDeceleration(0.0f);
	newAnimator.setRepeatCount(4); // up and down twice
	newAnimator.setRepeatBehavior(RepeatBehavior.REVERSE); // emphasize the first pass, then de-emphasizes
	return newAnimator;
}
 
Example 17
Source File: EdgeHoverAnimator.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected Animator createAnimator() {
	if (!useAnimation) {
		return null;
	}

	Animator newAnimator =
		PropertySetter.createAnimator(DURATION, this, "nextPaint", 0, DURATION);
	newAnimator.setAcceleration(0.0f);
	newAnimator.setDeceleration(0.8f);
	return newAnimator;
}
 
Example 18
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 19
Source File: AbstractTaskInfo.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public ScheduledTaskPanel getComponent() {
	if (component == null) {
		component = new ScheduledTaskPanel(getLabelText(), getIndention());
		if (useAnimation) {
			Color startColor = Color.YELLOW;
			Color endColor = Color.white;
			backgroundAnimator =
				PropertySetter.createAnimator(4000, this, "Background", startColor, endColor);
			backgroundAnimator.start();
		}
	}
	return component;
}
 
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();
}