All previous shapes show up while adding another shape in konvajs - annotations

I'm facing an issue with konvajs. I am able to draw things and they save all fine to be played with the end video.
However, Let's say I pause the video at 0:30 to add a circle and save it, and then I want to add another shape at 01:30, as soon as I start adding another shape the circle I added before also shows up on screen. So everytime I try and add a shape, I can see all the previous shapes on the screen.
Note: Problem is in adding the shapes, the end video plays fine (circle at 0:30 and another shape at 01:30). Is there any event that I can call to avoid this? Any help will be appreciated.

When you add a shape into the layer, you just need to hide/remove previous shapes.
You can do something like this:
oldShape.destroy();
// or remove all previous shapes
layer.destroyChildren();
// then
layer.add(newShape);
layer.draw();

Related

Image animation problems in Unity

I state that I am not very experienced in Unity.
I am working on a project in which I have some pictures. To these images I have added an animation that modifies the viewing scale (x,y,z), in such a way as to obtain a pulsation effect. ("ImageEffectPingPong")
To these same images, however, I added another animation that when the image is clicked, a fade effect is obtained, in such a way as to make the image disappear.("fadeOut_x")
When I go to make transition one of the two animations to the animator, it works as it should. the problem is when I try to merge them.
The ImageEffectPingPong animation is set in loop, while the other is activated by setting a bool to the onclick event.
animator.SetBool($"img_{pos}",true);
This is my animator
I tried a combination like this, but when I hit the first image, the fade works, but I no longer get the "pingpong" effect I want.
So how do i get the pingpong effect and when i click on an image, the fade effect, without losing the pingpong effect on the other images?
PS: to create the first effect I created a single animation that changes the scale of each image at the same time, while for the fade effect, each image has its own animation. Images can disappear following the correct sequence.
Sorry for my bad English, I hope I have explained myself as well as possible, I remain available for any misunderstandings. thank you
in case anyone has the same problem as me, I was able to solve it by adding a layer. In the first layer I run the fade animation, while in the second the pingpong effect. It is important to set the weight of the layer.

How can I change animation clip length?

The problem is that it's very short. The animation is walking. But the animation length is very short and I want to extend the walking.
When I select the walking animation I see it's read only:
After selecting it I can change the time but the clip it self will be still short:
Copy all keyframes, make a new animation clip, drag it out in time...
HOW TO:
You can select every single keyframe by dragging a marquee selection around all those keyframes and copying them.
Then create a new Animation Clip with the "Create New Clip..." choice in that dropdown where it's showing your current clip to be read only.
In the new clip, make sure the timeline is at 0, and past all your keyframes.
Now select all those keyframes again, with the marquee selection again, and grab the handle at the end, it should be a dark blue vertical stripe going from the top of the time line to the bottom. And drag this to the right, as far as you need. This should do an equal time scaling for all keyframes.
To make an animation within an imported model editable, select the model, expand the inner assets, select the animation, then press Ctrl+D (probably Cmd+D on mac?) to duplicate the animation clip. Unity will create a separate copy of it in your assets, which will then be editable.
However, for this specific case, I'd recommend looping the animations (you want the character to reach the door, She simply doesn't go that far in the animation). Otherwise, if you really just want to make the clip "longer", you can adjust the playback speed within Animator. After you add in a clip, select its node and you'll see an adjustable speed in the inspector.

How can I create a tile, overlay for a scene in Cocos2d?

I'm new to Cocos2d, but I can't seem to find the answer to this. I want to add an image that is mostly transparent as an overlay to my application. The image is overlayed on the app, and does not respond to screen taps. All gestures should "pass through" to the application.
The overlay image should actually be tiled. It's a small image that should repeat both horizontally and vertically.
How can I do this? In fact, this is an overlay that I would like to display for the duration of the entire application-- not just one specific scene. Is there a simple way to do this?
The point of my overlay is that I'd like to create a pseudo-scan line affect for a game which has an "8-bit" tone. The scan lines will be generated by applying the overlay to the game. The overlay is non-interactive and should always exist. So, this isn't a "tile based game", but I do need a tiling affect for this functionality.
You should be able to create a layer in each scene, set the zOrder to something large so that it overlays everything else, and set its isTouchEnabled attribute to NO. You can then add whatever you want to the layer, which could be your patterned image. To change the alpha, just set the opacity attribute of your image. The only issue that I can foresee is that the overlay might disable touch events for layers below it.

NSImageView and NSUndoManager

I have a image on the view and user can drag and move the image or rotate the image with finger touch.
I want to do Undo the action performed by user.
Like if the image is move to new location and then user press undo button, image should move back to the previous location. Or if user rotates the image and then press undo button it should rotate image to its previous angle.
It would be helpful if I get any sample example for the same.
Thanks in advance
Check out the Solution that Rob Posted here.
It only deals with one gesture at a time though. If you are dealing strictly with the Transform and the Center (for Pan) then You should be fine with his solution if you do not allow Pan, Rotate, Pinch at the same time. If Pinch Pinch and Rotate at the same time, if working with a Transform you just need to set the transform once at the beginning and deal with who sets it first so the other gesture does not set the Original Transform.
I'm working on a way to encapsulate multiple attributes into a Dictionary to then Undo/Redo, though need a way to copy that Dictionary to the Undo/Redo Stack, see this Question

How to make a line draw between two points as you are trying to set the second / end point of the line (like drawing a line in MSPAINT!)

I was wondering if anyone would be able to tell me how you would go about this?
e.g.
- User pushes (+) Add Button
- Image appears to let user set start point of line
- After user sets the first point a second image appears and a line is drawn between them and animated between them as user moves the second image into place.
You could see this sort of action in just about any graphics drawing program where a user is required to draw a line; except to help the user know where he is drawing I am including a start/end point image to drag about.
I can draw a line no problems. I am perplexed a little by this as the two images I generate for the user to drag around and set as start/end point are both instances of a class I created (draw2d) that subclasses UIImageView (so I can drag it about).
So at present I am adding two UIImageViews to my UIViewController in order to drag them about - you can't draw a line between two UIImageViews as such as the only drawing I know how to do is IN the UIImageView.
Do I need to nest these two images in a parent-style UIImageView so I can draw between them?
Any assistance is always greatly appreciated.
If I understand correctly, you want to draw the line while the user drags their finger around to set the endpoint?
Can't you just track the dragging positions and re-draw the line each time it changes, using the last dragged position as the 'temporary end point'?
Do I need to nest these two images in
a parent-style UIImageView so I can
draw between them?
Yes.