org.pushingpixels.trident.ease.Spline Java Examples

The following examples show how to use org.pushingpixels.trident.ease.Spline. 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: MercuryLoading.java    From MercuryTrade with MIT License 6 votes vote down vote up
public MercuryLoading() {
    this.setValue(0);
    this.setMaximum(3000);
    this.setForeground(AppThemeColor.TEXT_NICKNAME);
    this.setBackground(AppThemeColor.ADR_FOOTER_BG);

    this.setUI(new MercuryLoadingUi(this));

    this.progressTl = new Timeline(this);
    this.progressTl.setDuration(2400);
    this.progressTl.addPropertyToInterpolate("value", this.getMaximum(), 0);
    this.progressTl.setEase(new Spline(1));
    this.progressTl.addCallback(new TimelineCallbackAdapter() {
        @Override
        public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) {
            swapColors();
        }
    });
}
 
Example #2
Source File: AbstractRadial.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public AbstractRadial() {
      super();
      lcdTimeline = new Timeline(this);
      lcdValue = 0;
      lcdUnitString = getUnitString();
      ledPosition = new Point2D.Double(0.6, 0.4);
      userLedPosition = new Point2D.Double(0.3, 0.4);
      INNER_BOUNDS = new Rectangle(200, 200);
      GAUGE_BOUNDS = new Rectangle(200, 200);
      FRAMELESS_BOUNDS = new Rectangle(200, 200);
      FRAMELESS_OFFSET = new Point2D.Double(0, 0);
      transparentSectionsEnabled = false;
      transparentAreasEnabled = false;
      expandedSectionsEnabled = false;
      tickmarkDirection = Direction.CLOCKWISE;
      timeline = new Timeline(this);
      STANDARD_EASING = new Spline(0.5f);
      RETURN_TO_ZERO_EASING = new Sine();
horizontalAlignment = SwingConstants.CENTER;
verticalAlignment = SwingConstants.CENTER;
      lcdTextVisible = true;
      LCD_BLINKING_TIMER = new Timer(500, this);
      addComponentListener(this);
  }
 
Example #3
Source File: AbstractLinear.java    From mars-sim with GNU General Public License v3.0 6 votes vote down vote up
public AbstractLinear() {
    super();
    INNER_BOUNDS = new Rectangle(120, 300);
    startingFromZero = false;
    transparentSectionsEnabled = false;
    transparentAreasEnabled = false;
    ledPosition = new Point2D.Double((getInnerBounds().width - 18.0 - 16.0) / getInnerBounds().width, 0.453271028);
    userLedPosition = new Point2D.Double(18.0 / getInnerBounds().width, 0.453271028);
    lcdValue = 0;
    lcdTimeline = new Timeline(this);
    lcdUnitString = getUnitString();
    lcdInfoString = "";
    timeline = new Timeline(this);
    STANDARD_EASING = new Spline(0.5f);
    RETURN_TO_ZERO_EASING = new Sine();
    lcdTextVisible = true;
    LCD_BLINKING_TIMER = new Timer(500, this);
    addComponentListener(this);
}
 
Example #4
Source File: CardFlowTimeline.java    From magarena with GNU General Public License v3.0 6 votes vote down vote up
/**
     * Sets custom pulse behavior - higher frame rate, lower frame rate or dynamic frame rate.
     * <p>
     * By default, Trident timelines are driven by a dedicated thread that wakes up every 40ms and
     * updates all the timelines. When the CPU is not heavily used this results in 25 frames-per-second
     * refresh rate for Trident-driven UI animations - consistent with the frame rate of theatrical films
     * and non-interlaced PAL television standard.
     * <p>
     * (see https://kenai.com/projects/trident/pages/CustomPulseSource)
     *
     * Must be run before any instance of Timeline is created in the application otherwise it will
     * generate the "cannot replace the pulse source thread once it's running..." error.
     */
//    static {
//        try {
//            TridentConfig.getInstance().setPulseSource(() -> {
//                try {
//                    Thread.sleep(30);
//                } catch (InterruptedException ex) {
//                    LOGGER.log(Level.WARNING, null, ex);
//                }
//            });
//        } catch (RuntimeException ex) {
//            LOGGER.log(Level.WARNING, ex.getMessage());
//        }
//    }

    CardFlowTimeline(TimelineCallback aCallback, long durationMs) {
        setDuration(durationMs);
        setEase(new Spline(0.8f));
        addCallback(aCallback);
    }
 
Example #5
Source File: AnnotatedCardPanel.java    From magarena with GNU General Public License v3.0 6 votes vote down vote up
private void showPopup() {
    if (MagicAnimations.isOn(AnimationFx.CARD_FADEIN)) {
        if (opacity == 0f) {
            fadeInTimeline = new Timeline();
            fadeInTimeline.setDuration(200);
            fadeInTimeline.setEase(new Spline(0.8f));
            fadeInTimeline.addPropertyToInterpolate(
                Timeline.property("opacity")
                .on(this)
                .from(0.0f)
                .to(1.0f));
            fadeInTimeline.play();
        } else {
            opacity = 1.0f;
        }
    } else {
        opacity = 1.0f;
    }
    setVisible(true);
}
 
Example #6
Source File: MagicInfoWindow.java    From magarena with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void setVisible(boolean aFlag) {
    super.setVisible(aFlag);
    if (ImageHelper.isWindowTranslucencySupported()) {
        if (!aFlag) {
            setOpacity(0f);
        } else {
            fadeInTimeline = new Timeline();
            fadeInTimeline.setDuration(200);
            fadeInTimeline.setEase(new Spline(0.8f));
            fadeInTimeline.addPropertyToInterpolate(
                    Timeline.property("opacity")
                    .on(this)
                    .from(0.0f)
                    .to(1.0f));
            fadeInTimeline.play();
        }
    }
}
 
Example #7
Source File: TaskBarFrame.java    From MercuryTrade with MIT License 5 votes vote down vote up
private void initCollapseAnimations(String state) {
    collapseAnimation = new Timeline(this);
    switch (state) {
        case "expand": {
            collapseAnimation.addPropertyToInterpolate("width", this.getWidth(), MAX_WIDTH);
            break;
        }
        case "collapse": {
            collapseAnimation.addPropertyToInterpolate("width", this.getWidth(), MIN_WIDTH);
        }
    }
    collapseAnimation.setEase(new Spline(1f));
    collapseAnimation.setDuration(150);
}
 
Example #8
Source File: DependecyWPanel.java    From BART with MIT License 5 votes vote down vote up
public synchronized void animateBackground()   { 
    fadeInTimeline.addPropertyToInterpolate("backgroundLabelD",  0 , 55); 
    fadeInTimeline.setDuration(1500); 
    fadeInTimeline.setEase(new Spline(0.7f)); 
    fadeInTimeline.play(); 
    //fadeInTimeline.playLoop(2, Timeline.RepeatBehavior.LOOP);
}
 
Example #9
Source File: CardAnimation.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private Timeline getGrowTimeline() {
    final Timeline timeline = new Timeline(this);
    timeline.addPropertyToInterpolate("GrowRectangle", getStart(), getPreviewRectangle());
    timeline.setDuration(GROW_DURATION);
    timeline.setEase(new Spline(0.8f));
    return timeline;
}
 
Example #10
Source File: CardAnimation.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private Timeline getShrinkTimeline() {
    final Timeline timeline = new Timeline(this);
    timeline.addPropertyToInterpolate("ShrinkRectangle", getPreviewRectangle(), getEnd());
    timeline.setDuration(SHRINK_DURATION);
    timeline.setEase(new Spline(0.8f));
    timeline.addCallback(new TimelineCallbackAdapter() {
        @Override
        public void onTimelineStateChanged(Timeline.TimelineState oldState, Timeline.TimelineState newState, float durationFraction, float timelinePosition) {
            if (newState == Timeline.TimelineState.DONE) {
                scenario.cancel();
            }
        }
    });
    return timeline;
}
 
Example #11
Source File: AnimationPanel.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private void startPulsingBorderAnimation() {
    if (GeneralConfig.get(BooleanSetting.ANIMATE_GAMEPLAY)) {
        stopPulsingBorderAnimation();
        pulseBorderTimeline.setDuration(500);
        pulseBorderTimeline.setEase(new Spline(0.8f));
        pulseBorderTimeline.addPropertyToInterpolate(
                Timeline.property("pulsingBorderOpacity").on(this).from(20).to(200));
        pulseBorderTimeline.playLoop(Timeline.RepeatBehavior.REVERSE);
    }
}
 
Example #12
Source File: PlayerImagePanel.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private void doHealAnimation() {
    if (GeneralConfig.get(BooleanSetting.ANIMATE_GAMEPLAY)) {
        final Timeline timeline = new Timeline();
        timeline.setDuration(1000);
        timeline.setEase(new Spline(0.8f));
        timeline.addPropertyToInterpolate(
                Timeline.property("healColorOpacity").on(this).from(100).to(0));
        timeline.play();
    }
}
 
Example #13
Source File: ChoiceBorderPanelButton.java    From magarena with GNU General Public License v3.0 5 votes vote down vote up
private void startPulsingBorderAnimation() {
    if (MagicAnimations.isOn(AnimationFx.AVATAR_PULSE)) {
        stopPulsingBorderAnimation();
        pulseBorderTimeline.setDuration(500);
        pulseBorderTimeline.setEase(new Spline(0.8f));
        pulseBorderTimeline.addPropertyToInterpolate(
                Timeline.property("ChoiceBorderOpacity").on(this)
                    .from(20).to(CHOICE_BORDER_MAX_OPACITY)
        );
        pulseBorderTimeline.playLoop(Timeline.RepeatBehavior.REVERSE);
    }
}