use of org.jwildfire.envelope.Envelope in project JWildfire by thargor6.
the class AnimationService method evalCurve.
public static double evalCurve(double pFrame, MotionCurve curve) {
MotionCurve currCurve = curve;
double value = 0.0;
while (currCurve != null) {
Envelope envelope = currCurve.toEnvelope();
value += envelope.evaluate(pFrame);
currCurve = currCurve.getParent();
}
return value;
}
use of org.jwildfire.envelope.Envelope in project JWildfire by thargor6.
the class EnvelopeController method createEnvelope.
public void createEnvelope() {
String propName = (String) propertyCmb.getSelectedItem();
Parameter parameter = currAction.getParameterByName(propName);
Double val = Double.parseDouble(parameter.getValue());
Envelope env = new Envelope(val);
env.select(0);
parameter.setEnvelope(env);
setCurrEnvelope(env);
enableControls();
refreshEnvelope();
}
use of org.jwildfire.envelope.Envelope in project JWildfire by thargor6.
the class ChannelMixerPanelDelegate method refreshCurve.
public void refreshCurve(Flame pFlame) {
Envelope envelope = getCurve(pFlame).toEnvelope();
ctrl.setEnvelope(envelope);
envelopePanel.setEnvelope(envelope);
ctrl.refreshEnvelope();
}
use of org.jwildfire.envelope.Envelope in project JWildfire by thargor6.
the class AbstractControlsDelegate method editMotionCurve.
protected void editMotionCurve(MotionCurve pCurve, double pInitialValue, String pPropName, String pLabel) {
Envelope envelope = pCurve.toEnvelope();
if (envelope.getX().length == 0) {
int[] x = new int[] { 0 };
if (pInitialValue <= envelope.getViewYMin() + 1) {
envelope.setViewYMin(pInitialValue - 1.0);
}
if (pInitialValue >= envelope.getViewYMax() - 1) {
envelope.setViewYMax(pInitialValue + 1.0);
}
double[] y = new double[] { pInitialValue };
envelope.setValues(x, y);
}
EnvelopeDialog dlg = new EnvelopeDialog(SwingUtilities.getWindowAncestor(rootPanel), owner.getErrorHandler(), envelope, true);
dlg.setFlameToPreview(EnvelopeDialogFlamePreviewType.MOTION_CURVE, owner.getCurrFlame(), pCurve);
dlg.setTitle("Editing " + pLabel);
dlg.setModal(true);
dlg.setVisible(true);
if (dlg.isConfirmed()) {
Flame flame = owner.getCurrFlame();
if (useUndoManager) {
owner.undoManager.saveUndoPoint(flame);
}
if (dlg.isRemoved()) {
pCurve.setEnabled(false);
} else {
pCurve.assignFromEnvelope(envelope);
pCurve.setEnabled(true);
}
owner.refreshFlameImage(true, false, 1, true, false);
}
}
use of org.jwildfire.envelope.Envelope in project JWildfire by thargor6.
the class EnvelopePropertyEditor method selectEnvelope.
protected void selectEnvelope() {
Envelope editEnvelope = envelope.clone();
EnvelopeDialog dlg = new EnvelopeDialog(SwingUtilities.getWindowAncestor(editor), new ErrorHandler() {
@Override
public void handleError(Throwable pThrowable) {
pThrowable.printStackTrace();
}
}, editEnvelope, false);
dlg.setModal(true);
dlg.setVisible(true);
if (dlg.isConfirmed()) {
Envelope oldEnvelope = envelope;
label.setValue(editEnvelope);
envelope = editEnvelope;
firePropertyChange(oldEnvelope, editEnvelope);
}
}
Aggregations