<commit_before>package de.lessvoid.nifty.effects.general;

import java.util.Properties;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.elements.Element;
import de.lessvoid.nifty.render.NiftyRenderEngine;

/**
 * Shake effect.
 * @author void
 */
public class Shake implements EffectImpl {

  /**
   * distance.
   */
  private float distance;

  /**
   * global.
   */
  private boolean global;

  /**
   * initialize.
   * @param nifty Nifty
   * @param element Element
   * @param parameter Parameter
   */
  public void initialize(final Nifty nifty, final Element element, final Properties parameter) {
    distance = Float.parseFloat(parameter.getProperty("distance", "10.0"));
    global = "true".equals(parameter.getProperty("global", "true").toLowerCase());
  }

  /**
   * execute the effect.
   * @param element Element
   * @param normalizedTime TimeInterpolator
   * @param r RenderDevice
   */
  public void execute(final Element element, final float normalizedTime, final NiftyRenderEngine r) {
    float t = normalizedTime;
    if (t > 0.0f) {
      float d = (1.0f - t) * distance;
      float x = -d + (float) Math.random() * 2 * d;<commit_msg>make shake intensity independent of efffect time<commit_after>package de.lessvoid.nifty.effects.general;

import java.util.Properties;

import de.lessvoid.nifty.Nifty;
import de.lessvoid.nifty.elements.Element;
import de.lessvoid.nifty.render.NiftyRenderEngine;

/**
 * Shake effect.
 * @author void
 */
public class Shake implements EffectImpl {

  /**
   * distance.
   */
  private float distance;

  /**
   * global.
   */
  private boolean global;

  /**
   * initialize.
   * @param nifty Nifty
   * @param element Element
   * @param parameter Parameter
   */
  public void initialize(final Nifty nifty, final Element element, final Properties parameter) {
    distance = Float.parseFloat(parameter.getProperty("distance", "10.0"));
    global = "true".equals(parameter.getProperty("global", "true").toLowerCase());
  }

  /**
   * execute the effect.
   * @param element Element
   * @param normalizedTime TimeInterpolator
   * @param r RenderDevice
   */
  public void execute(final Element element, final float normalizedTime, final NiftyRenderEngine r) {
    float t = normalizedTime;
    if (t > 0.0f) {
      float d = distance;
      float x = -d + (float) Math.random() * 2 * d;
{'fraction_non_alphanumeric': 0.12055837563451777, 'fraction_numerical': 0.005922165820642978, 'mean_word_length': 3.3235831809872027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4737897', 'n_tokens_mistral': 737, 'n_tokens_neox': 729, 'n_words': 193}