/** * Calculates the position on the spiral for the specified polar angle. This takes an additional * parameter of a {@link Vector3} which will be set to the calculated position. * * @param result {@link Vector3} to set with the updated position. * @param theta {@code double} the polar angle to calculate for, in degrees. */ public void calculatePointDegrees(Vector3 result, double theta) { calculatePoint(result, Math.toRadians((mSpiralIn ? mThetaOffset - theta : theta + mThetaOffset))); }
/** * Adds an object configuration to the animation at the end of the list. * * @param object {@link CoalesceConfig} The new configuration to add to the animation list. */ public void addCoalescingObject(CoalesceConfig object) { mCoalesceObjects.add(object); mThetaRanges.add(object.spiral.calculateThetaForRadius(object.endProximity)); }
/** * Adds a {@link List} of object configurations to the animation at the end of the list. * * @param objects {@link List} of {@link CoalesceConfig} The new configurations to add to the animation list. */ public void addCoalescingGroup(List<CoalesceConfig> objects) { for (CoalesceConfig config : objects) { mCoalesceObjects.add(config); mThetaRanges.add(config.spiral.calculateThetaForRadius(config.endProximity)); } }
@Override protected void applyTransformation() { synchronized (mCoalesceObjects) { synchronized (mThetaRanges) { int i; final int j = mCoalesceObjects.size(); for (i = 0; i < j; ++i) { // Retrieve the configuration CoalesceConfig config = mCoalesceObjects.get(i); double theta = mThetaRanges.get(i) * mInterpolatedTime; // Calculate the next point config.spiral.calculatePoint(config.object.getPosition(), theta); // Add the coalesce point to translate our spiral config.object.getPosition().add(config.coalesceAroundPoint); } } } }
/** * Constructs a basic coalescence animation. * * @param rootConfig {@link CoalesceConfig} The root object of the animation. This is simply the first item in * item in the animation list. */ public CoalesceAnimation3D(CoalesceConfig rootConfig) { mCoalesceObjects = Collections.synchronizedList(new CopyOnWriteArrayList<CoalesceConfig>()); mThetaRanges = Collections.synchronizedList(new CopyOnWriteArrayList<Double>()); mTransformable3D = rootConfig.object; mCoalesceObjects.add(rootConfig); mThetaRanges.add(rootConfig.spiral.calculateThetaForRadius(rootConfig.endProximity)); }
/** * Calculates the position on the spiral for the specified polar angle. This takes an additional * parameter of a {@link Vector3} which will be set to the calculated position. * * @param result {@link Vector3} to set with the updated position. * @param theta {@code double} the polar angle to calculate for, in degrees. */ public void calculatePointDegrees(Vector3 result, double theta) { calculatePoint(result, Math.toRadians((mSpiralIn ? mThetaOffset - theta : theta + mThetaOffset))); }
/** * Adds an object configuration to the animation at the end of the list. * * @param object {@link CoalesceConfig} The new configuration to add to the animation list. */ public void addCoalescingObject(CoalesceConfig object) { mCoalesceObjects.add(object); mThetaRanges.add(object.spiral.calculateThetaForRadius(object.endProximity)); }
@Override protected void applyTransformation() { synchronized (mCoalesceObjects) { synchronized (mThetaRanges) { int i; final int j = mCoalesceObjects.size(); for (i = 0; i < j; ++i) { // Retrieve the configuration CoalesceConfig config = mCoalesceObjects.get(i); double theta = mThetaRanges.get(i) * mInterpolatedTime; // Calculate the next point config.spiral.calculatePoint(config.object.getPosition(), theta); // Add the coalesce point to translate our spiral config.object.getPosition().add(config.coalesceAroundPoint); } } } }
/** * Adds a {@link List} of object configurations to the animation at the end of the list. * * @param objects {@link List} of {@link CoalesceConfig} The new configurations to add to the animation list. */ public void addCoalescingGroup(List<CoalesceConfig> objects) { for (CoalesceConfig config : objects) { mCoalesceObjects.add(config); mThetaRanges.add(config.spiral.calculateThetaForRadius(config.endProximity)); } }
/** * Constructs a basic coalescence animation. * * @param rootConfig {@link CoalesceConfig} The root object of the animation. This is simply the first item in * item in the animation list. */ public CoalesceAnimation3D(CoalesceConfig rootConfig) { mCoalesceObjects = Collections.synchronizedList(new CopyOnWriteArrayList<CoalesceConfig>()); mThetaRanges = Collections.synchronizedList(new CopyOnWriteArrayList<Double>()); mTransformable3D = rootConfig.object; mCoalesceObjects.add(rootConfig); mThetaRanges.add(rootConfig.spiral.calculateThetaForRadius(rootConfig.endProximity)); }