Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsontom committed Oct 2, 2017
1 parent 5b305d0 commit 5202abd
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2017 BestSolution.at and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tom Schindl<[email protected]> - initial API and implementation
*******************************************************************************/
package org.eclipse.fx.ui.animation;

import javafx.animation.Transition;
import javafx.beans.property.DoubleProperty;
import javafx.util.Duration;

/**
* Transition updating a double property
*/
public class DoublePropertyTransition extends Transition {
private final DoubleProperty p;
private double from;
private double delta;

/**
* Create a new transition
*
* @param p
* the double property to update
* @param duration
* the duration
* @param from
* the start value
* @param to
* the end value
*/
public DoublePropertyTransition(DoubleProperty p, Duration duration, double from, double to) {
this.p = p;
setCycleDuration(duration);
this.delta = to - from;
}

@Override
protected void interpolate(double frac) {
this.p.set(this.from + this.delta * frac);
}

}

0 comments on commit 5202abd

Please sign in to comment.