Move an item in illustrator to a specific location - photo

I have created an action to move an item relatively in illustrator. This all works but I am looking for a way to move an item absolutely. So to a specific location no matter where it is.
Could anybody tell me how to do this in Illustrator?

To place object in some absolute position you can use Transform Panel:
open Transform Panel(Shift+F8)
enter absolut position (x and y coordinates).
to record this action do the same during recording.

Related

Can I place an object in air - 360 angle (random position) without click instead of find plane in unity Vuforia mid air

I'm trying to show my 3D object in mid air. Currently my object shows on click event, but I don't want click event. I just want the object shown in a random position in midair.
if I break your question into two, then,
Vuforia uses "Anchor input Listener Behavior" to receive the input for the mid-air anchor. I am not sure it will work without a click event.
you have to click to lock the mid-air target, you can gamify it by showing a pop up "click to start".
However, there is always a way out. If you go through PlaneManager.cs class then you fill find a method "PlaceObjectInMidAir", you can carefully build logic and call the following lines in Update method but for one time.
if (TrackingStatusIsTrackedAndNormal)
{
this.contentPositioningBehaviour.AnchorStage = this.midAirAnchor;
this.contentPositioningBehaviour.PositionContentAtMidAirAnchor(midAirTransform);
UtilityHelper.EnableRendererColliderCanvas(this.midAirAugmentation, true);
this.midAirAugmentation.transform.localPosition = Vector3.zero;
UtilityHelper.RotateTowardCamera(this.midAirAugmentation);
}
To spawn the gameobjects randomly in 360 degree, you can use instantiate method in random position with "Random.insideUnitSphere" [see the link]
https://docs.unity3d.com/ScriptReference/Random-insideUnitSphere.html
then make that object child of mid-air Achor "Anchor_MidAir".
Hope my answer would give you a start push.
Good luck!
currently my object show on click event i don't wont click event just object show on random position of midair
If I understand that correctly, your object is shown when the mouse is clicked, and instead of this you want to show it in a random position. Here's what you should do:
Don't listen to that click event. If you don't want something to happen on click, just don't write any code that does that!
To teleport an object to a random position, decide what the minimum and maximum values for your object's position are, and do the following:
yourGameObject.transform.position = new Vector3(
Random.Range(minX, maxX),
Random.Range(minY, maxY),
Random.Range(minZ, maxZ));

Mouse position not consistent with HTML canvas ondrag

I am trying to drag some shapes in HTML canvas but I am encountering a problem with respect to determining the change in mouse coordinates [dx,dy]
First of all, there is no problem in the coordinates themselves, stored in mousePos as the rollover effects work flawlessly. What I am doing is, upon first entering the shape, saving the mouse coordinates.
pos = {x : mousePos[0] , y : mousePos[1]};
Then, onMotion updates the coordinates everytime the mouse moves as well as recording the current position
dx=mousePos[0]-pos.x;
dy=mousePos[1]-pos.y;
pos = {x : mousePos[0] , y : mousePos[1]};
Then I add the dx and dy values to the shapes coordinates (lets take a simple rectangle as an example)
ctx.fillRect(0+this.dx,0+this.dy,100+this.dx,100+this.dy);
as long as the mouse doesn't move too fast, it works relatively well (not perfect though). If I move the mouse very quickly, without going out of the window, the rectangle does not catch up with the mouse. I can understand if there is a delay catching up to the mouse, but how can the delta values be off? Clearly we know where we started, and even if dozens/hundreds of pixels are skipped in the process, eventually the mouse should stop and the correct delta values should be calculated.
Any help would be greatly appreciated as I have hit a conceptual wall here.
You might try to get e.layerX-Y when the onMotion is fired to get the real position instead of the delta. This way it can't be "off".
To use this, place your shape into a div with style="padding:0px;margin=0px;" , because the position is relative to the parent block.

iOS - Dragging objects along curved paths

I am tearing my hair out trying to figure out what seems to be a very easy problem. I know a lot of this stuff has been talked about tangentially, so apologies if this treads on well-covered ground, but I can't find anything specific to my solution (believe me, I've looked).
Basically I want to drag an object/sprite along a pre-defined, curved path (not just move it, but DRAG IT). Think of the iPhone's "Slide to unlock" thing, but instead of just dragging the slider left-to-right, make the path an arc or a wavy line.
My basic thinking was:
define a bezier path, set the object at the start point.
if the object is touched, check for hit detection on the bezier path in touchesMoved (or some similar function). if touches stay on the path, advance the sprite along the path until the path ends (in which case, task is finished) or the user's finger goes off the path (in which case, the object should go back to the beginning).
None of this is trivial (at least, that's how it seems). For example:
Doing hit detection on a Bezier path is a royal pain since you actually need to do it on the stroked portion, not the fill portion. And even then, I can't seem to find a way to do it on a path of any width -- only on the 1-point-wide path of the Bezier.
Moving an object partially along a path doesn't even seem possible: all of the animation methods move the sprite along the ENTIRE path. Also, doing this requires you to find the point on the path closest to the user's touch, which, if you've ever looked this up involves astoundingly complicated math.
I've thought of using rigid bodies to occupy all of the space EXCEPT the path, so the object can only move in the path. However, this requires the definition of curved rigid bodies some of which must be concave. Dead end.
Am I making this too hard? It doesn't seem that complicated. I don't need a whole solution, just a new way to think about this and kick in the right direction. Any help would be really appreciated.
How about this?
Consider the X Axis of your bezier
path.
Each time the user taps or interacts with the screen just look at the x portion of the touch
Map that X Coordinate with your path and move the object to the right position.
Yes, you are making this too hard.
Take the simplification suggested above (or along a circle, line, etc) if it works for, or if you really want to do it against a bézier curve, consider the following:
Look at the definition of the bézier curve
What you're looking for is to define a new object position P' from a current position P and a change in touch position D.
If you rephrase the original P(x,y) in terms of t (bézier curves are parametric), then the problem becomes finding how much t offset to add based on D.
Something involving the differential of the bezier fn at P might be a good way to do that. Ie, how much t would have been added had the curve just been a straight line coming from point P along the curve.
EDIT:
Transition between segments:
If each segment has t in [0,1), then you can detect t >= 1 and move on to the next segment, setting P to the end of the previous segment, and evaluating the movement again in relation to that point. There might have to be some heuristics involved if you have a lot of small points, etc.

Drag object with touchesMoved along offset vector / delta?

In the touchesMoved method, what is the math to have an object on the screen move along a dragging touch vector? For instance, if I touch beneath my object (Y > object.y), and drag "up", I want the object to move from its current x,y location along the same vector that my finger moves.
Currently I have it working that the drag motion snaps my object to my finger's location, but sometimes my finger hits the edge of the screen before I get my object positioned correctly.
If I know my "touch down location" and the "current touch location" what is the math to determine where to move object.position?
I hope that you have already received the answer of figured it out yourself, but.
Assume that your object's Upper Left Corner (ULC) is at Object.X, ObjectY.
Assume that the CGPoint returned by touchsBegan is Touch.X, Touch.Y.
The offset (Delta) will be:
Delta.X = Touch.X - Object.X
Delta.Y = Touch.Y - Object.X
Subtract these from each point returned by touchesMoved and your ULC should move as you expect rather than snapping to your finger.
Good luck.
I would look into UIPanGestureRecognizer. It's what I use when I want to accomplish something like what you are describing.
This is what I used to learn about them but then took it further in other forms:
http://www.cocoanetics.com/2010/11/draggable-buttons-labels/
Good luck!

iphone cocoa : how to drag an image along a path

I am trying to figure out how can you drag an image while constraining its movement along a certain path.
I tried several tricks including animation along a path, but couldn't get the animation to play and pause and play backwards - so that seems out of the question.
Any ideas ? anyone ?
What you're basically trying to do is match finger movement to a 'translation' transition.
As the user touches down and starts to move their finger you want to use the current touch point value to create a translation transform which you apply to your UIImageView. Here's how you would do it:
On touch down, save the imageview's starting x,y position.
On move, calculate the delta from old point to new one. This is where you can clamp the values. So you can ignore, say, the y change and only use the x deltas. This means that the image will only move left to right. If you ignore the x and use y, then it only moves up and down.
Once you have the 'new' calculated/clamped x,y values, use it to create a new transform using CGAffineTransformMakeTranslation(x, y). Assign this transform to the UIImageView. The image moves to that place.
Once the finger lifts, figure out the delta from the original starting x,y, point and the lift-off point, then adjust the ImageView's bounds and reset the transform to CGAffineTransformIdentity. This doesn't move the object, but it sets it so subsequent accesses to the ImageView use the actual position and don't have to keep adjusting for transforms.
Moving along on a grid is easy too. Just round out the x,y values in step 2 so they're a multiple of the grid size (i.e. round out to every 10 pixel) before you pass it on to make the translation transform.
If you want to make it extra smooth, surround the code where you assign the transition with UIView animation blocks. Mess around with the easing and timing settings. The image should drag behind a bit but smoothly 'rubber-band' from one touch point to the next.
See this Sample Code : Move Me