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

The following examples show how to use org.jdesktop.animation.timing.Animator#setDeceleration() . 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: 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 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: 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 4
Source File: IntroPanel.java    From littleluck 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 5
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 6
Source File: IntroPanel.java    From Darcula 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 7
Source File: IntroPanel.java    From beautyeye 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 8
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 9
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 10
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 11
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 12
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 13
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 14
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 15
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 16
Source File: CenterAnimation.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
public Animator createAnimator() {
	Animator newAnimator =
		PropertySetter.createAnimator(duration, this, "percentComplete", 0.0, 1.0);
	newAnimator.setAcceleration(0f);
	newAnimator.setDeceleration(0.8f);

	return newAnimator;
}
 
Example 17
Source File: MergeVertexFunctionGraphJob.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected Animator createAnimator() {
	initializeVertexLocations();

	if (!useAnimation) {
		return null;
	}

	Animator newAnimator =
		PropertySetter.createAnimator(DURATION, this, "percentComplete", 0.0, 1.0);
	newAnimator.setAcceleration(0f);
	newAnimator.setDeceleration(0.8f);
	return newAnimator;
}
 
Example 18
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 19
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 20
Source File: MoveViewAnimatorFunctionGraphJob.java    From ghidra with Apache License 2.0 5 votes vote down vote up
@Override
protected Animator createAnimator() {
	destination = createDestination();

	RenderContext<V, E> renderContext = viewer.getRenderContext();
	multiLayerTransformer = renderContext.getMultiLayerTransformer();

	if (!useAnimation) {
		return null;
	}

	double offsetX = destination.getX();
	double offsetY = destination.getY();
	double durationX = Math.abs(offsetX / PIXELS_PER_SECOND);
	double durationY = Math.abs(offsetY / PIXELS_PER_SECOND);

	int totalFramesX = (int) (durationX * FRAME_PER_SECOND);
	int totalFramesY = (int) (durationY * FRAME_PER_SECOND);

	int mostFrames = Math.max(totalFramesX, totalFramesY);
	mostFrames = Math.min(mostFrames, 15); // limit the time to something reasonable
	totalFrames = Math.max(1, mostFrames); // at least one frame

	double timeInSeconds = (double) totalFrames / (double) FRAME_PER_SECOND;
	int duration = (int) Math.round(timeInSeconds * 1000); // put into millis
	
	Point2D start = new Point2D.Double();
	Animator newAnimator =
		PropertySetter.createAnimator(duration, this, "offset", start, destination);
	newAnimator.setAcceleration(0.2f);
	newAnimator.setDeceleration(0.8f);

	return newAnimator;
}