After Effects: Move a layer after Position keyframes have been added - position

I'm not sure how to word this question.
So here's an example.
The animation on a layer slides into view, and bounces back slightly.
Easy peasy.
The Position Keyframes look something like this:
Keyframe 0: (-100,200)
Keyframe 10: (100,200)
Keyframe 15: (125,200)
Keyframe 20: (100,200)
Let's say I want to move this layer, because I don't like where it's vertically positioned. So, I've been selecting each Keyframe (0,10,15,20) and manually changing the Y-axis to whatever number.
Is there an easier way to do this?
I'd like to be able to highlight the layer in the timeline, [press some button] + drag to where I would like it to be on the Y-axis, and the keyframes update themselves

Two ways to do this;
Create a null object (new layer - null object), and attach the animated layer to the null object (click and drag the swirly icon on the animated layer - drag it to the null layer and it should parent to the null layer). Now you can move the position of the null layer and it will move the animated layer, preserving your keyframes.
If you make sure the playhead is over one of the keyframes, and highlight ALL your keyframes, then when you move the position of the layer (e.g move Y up 150) it will apply the same move to all keyframes.

Related

Using tk.Scrollbar to update images in tk.canvas

I developed a small tkinter GUI to display (and export) images stored in a proprietary format. I managed to load the data into a 3D numpy uint8 array. I want to display one slice of that 3D array in a tkinter.canvas. To do so I used ImageTk.PhotoImage.
Underneath the Canvas I inserted a tk.Scrollbar. My goal is to use that scrollbar to let the user actively "scroll" though the 3D Array. Basically when the slider is moved or any of the arrows is pressed the slice corresponding to the slider position should be displayed in the canvas.
Right now I have the issue that I don't understand how to set the range of the scrollbar to my z-Dimension and then how to bind the scrollbar events to the movement or arrow actions to update the canvas.
Right now I don't have example code since this is a more conceptual problem.
Could you point me in the right direction how to solve this?
Best TMC
edit: Photo
Tkinter Gui with Canvas and Scrollbar
The solution is to use tkinter.Scale instead of tkinter.Scrollbar . As a side note, the command within:
scale = tk.Scale(yourTkFrame, from_=min, to=max, orient='horizontal', command=doSomething)
passes two values to the function doSomething.
Using the Scale allows to use the scale.get() method to retrieve the position between min and max values. Those can then be used to set the image corresponding to the selected position on the slide.

How to change the default label positions of connectors in Enterprise Architect

I'm drawing activity diagram by Enterprise Architect 12. The diagram type is Activity under UML Behavioral. I found the positions of the labels of connectors are close to the target element as shown in the picture. It's very confusing.
How to change the default label positions to make them close to the source element as shown in picture?
Or is there any easy way to change the label of connector from Target Top Label to Source Top Label?
Better you use Guards for the label which you find in the Constraints tab. These appear in the middle label position and enclosed in square brackets. This is actually what you want to show.
For your amusement here's my original answer
There is no way to change the label position the way you want it out-of-the-box. You will need to write a script to do that.
There are two ways to accomplish such a script. The most comfortable is to use an add-in that responds to EA_OnPostNewConnector. You would then need to check whether the connector is one from a Decision to an Action and move the label accordingly.
The second one is to have a simple script (you might edit in EA's scripting window) that you run for an open diagram to scan for all Decisions in a diagram and alter the label position accordingly.
Altering the label
Once you got a connector from a Decision to an Action at hand you will need to change the label position like this:
get the according connector from DiagramLinks since it has the label position
get the element IDs from Connector.ClientID and .SupplierID and retrieve the elements with Respository.GetElementByID(<id>)
assign both elements to either decision or action by looking into the Element.Type
get the according DiagramObjects from the diagram which match the both elements (so you can get their position on the diagram)
now it's time for a little trigonometry: the position (DiagramElement.Left, .Right, .Top and .Bottom contain the appropriate coordinates) of the two elements makes out a vector at which end you calculate (I will leave you some fun) the label position where you think it should go
finally you take this coordinate and put it into the label position (see below).
The label position is stored in DiagramObject.Geometry. This is a semicolon separated string where one tag is LRT=<colon-list>;. <colon-list> itself is a colon-separated list where two are something like OX=-1:OY=-71: and represent the label position. This is a position relative to the "normal" position where the label is placed initially by EA.
So all in all: lot's of fun awaiting you :-/

GTK+/Cairo - drawing to a temporary layer?

I'm drawing nodes on to a window, and when you click them I want it select the node and color it a different colour.
And then it might go off and do something else, and I want it to return the original color.
Is there a way of drawing on to an overlapping layer, and then just undisplay that layer?
Ie, rather than having to go through and redraw everything again.
Similarly - if I'm want a 'drag to draw line', how would I do this?
You should try with something like goocanvas widgets.

What is the proper way of drawing label in OpenGL Viewport?

I have a multiviewport OpenGL modeler application. It has three different viewports : perspective, front and top. Now I want to paint a label for each viewport and not succeeding in doing it.
What is the best way to print a label for each different perspective?
EDITED : The result
Here is the result of my attempt:
I don't understand why the perspective viewport label got scrambled like that. And, Actually I want to draw it in the upper left corner. How do I accomplished this, because I think it want 3D coordinate... is that right? Here is my code of drawing the label
glColor3f(1,0,0);
glDisable(GL_DEPTH_TEST);
glDepthMask(GL_FALSE);
glRasterPos2f(0,0);
glPushAttrib(GL_LIST_BIT); // Pushes The Display List Bits
glListBase(base - 32); // Sets The Base Character to 32
glCallLists(strlen("Perspective"), GL_UNSIGNED_BYTE, "Perspective"); // Draws The Display List Textstrlen(label)
glPopAttrib();
I use the code from here http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=13
thanks
For each viewport switch into a projection that allows you to supply "viewport space" coordinates, disable depth testing (glDisable(GL_DEPTH_TEST)) and depth writes (glDepthMask(GL_FALSE)) and draw the text using one of the methods used to draw text in OpenGL (texture mapped fonts, rendering the full text into a texture drawing that one, draw glyphs as actual geometry).
Along with #datenwolf's excellent answer, I'd add just one bit of advice: rather than drawing the label in the viewport, it's usually easier (and often looks better) to draw the label just outside the viewport. This avoids the label covering anything in the viewport, and makes it easy to get nice, cleanly anti-aliased text (which you can normally do in OpenGL as well, but it's more difficult).
If you decide you need to draw the text inside the viewport anyway, I'll add just one minor detail to what #datenwolf said: since you generally do want your text anti-aliased (even if the rest of the picture isn't) you generally want to draw the label after all the other geometry of the picture itself. If you haven't turned on anti-aliasing otherwise, you generally will want to turn it on for drawing the text.

How to cut a hole in an SVG rectangle [duplicate]

This question already has answers here:
How can I cut one shape inside another?
(4 answers)
Closed 6 years ago.
So basically as my title says, I want to "cut a hole" in a rect element.
I have two rect elements, one on top of the other. The one on the bottom has a fill colour of white, and the one on the top has a fill colour of grey.
What I want to do is cut a triangle out of the top rect element so that the rect element below shows through.
This svg element is going to be used as an audio button for a media player on a page. In other words, you'll be able to click (or drag) your mouse left/right and the change in audio level will be represented by a change in the width of the rect element on the bottom, which shows through the triangle cut out of the top rect element.
I hope that's not too confusing. :P
Here is a quick mockup of what it should look like: http://forboden.com/coding/s1.png
Here is my code: http://forboden.com/coding/svgClipTest.html
Where am I going wrong here?
You should be able to use the fill-rule: evenodd(default) property to achieve this effect, if you want to prevent the fill of the rectangle from painting where the circle is. See this example from the SVG specification:
The key point is draw outer shape and inner shapes(holes) in different direction (clockwise vs anti-clockwise).
Draw the outer shape clockwise and draw the inner(holes) shapes anti-clockwise.
Or conversely, draw the outer shape(holes) anti-clockwise and draw the inner shapes clockwise.
Concat the path datas of outer shape and inner shapes(holes).
You can cut more holes by concat more hole path data.
This image explain how to cut a hole:
I see that you have it solved already, just wanted to add that if you want something more advanced then it's often quite easy to use a <mask>, see http://dev.w3.org/SVG/profiles/1.1F2/test/svg/masking-path-11-b.svg for example.
However, if you can avoid masking and clipping (e.g by just drawing things on top) that usually leads to better performance/user-experience.
Easiest way is to use <path> with the hole, and set pointer-events to none so events can pass through to the <rect> under. Of course there are many other ways to handle events such as wrapping them with a <g> and handling events on it.
You don't need to limit yourself to the basic shapes and use complicated clipping. Make things felxible enough so you can copy&paste path data generated by tools like inkscape.

Resources