Manim animation in loop - animation

I am creating two animations simultaneously in manim 1) square to circle and 2)square to circle but the circle in first animation won't fade out until the end of second animation.how to fade that circle out how to stop that first animation before start of second one . I have used fadeout function but circle is not fading out it remains there until the end of second animation
Is there any other way to this

Related

How can I crop a shape inside a shape

So there us a billion and one articles about cropping an image inside a shape. But how do I crop a shape inside a shape?
Lets say I have a star shape inside a rectangular shape and I only want to draw the part of the star that's inside the rectangular.
In PowerPoint - how do I crop a shape inside another shape so nothing from the first shape is drawn outside the second shape?

Raycaster missing half a plane in three.js - bug?

In order to stretch a 2D rounded rectangle without distortion, I repositioned the rectangle towards one direction (eg left) by the desired amount and added that amount to the right-most vertices to compensate and appear stretched.
The problem is that now raycaster is missing the right-half of the rectangle.
I made the following jsfiddle stretching a normal rectangle:
http://jsfiddle.net/vser1n2u/5/
If you hover the mouse on the rectangle you’ll see that raycaster works properly (“TRUE” indication). If you click on the rectangle, it will expand to the left. Now if you hover you’ll see that it works only half way (“FALSE” indication).
Am I missing something, or is this a three.js bug?
When you modify the vertices of a geometry after it has been rendered, you need to recompute the bounding sphere for raycasting and frustum culling to work correctly.
So in your case,
o.m.geometry.computeBoundingSphere();
Updated fiddle: http://jsfiddle.net/vser1n2u/6/
three.js r.98

2D: Find the angle between mouse position and gameObject

I have a beer bottle positioned at top of a glass at 90%. I want to rotate it around its Pivot which is at the top. In order to do so i'm trying to find the angle between the the mouseposition(mp) and the bottle and rotate ti by it.
The center of rotation is the current position of the GameObject since the Pivot of the sprite is at the top. I tried to find two Vectors one being the vector from mp to center of rotation and the other one being the position of the bottle. Then i used: gameObject.transform.Rotate(Vector3.Forward, Vector3.Angle(v2,v1)).
The result its not what i expected of course. I'm new to this game math, i'd appreciate an explanation.
(Its an android game and i intend to drag the bottle up and down from 90 to 180 degrees).
I hope that i understand you question correctly.
But if you want to find the angle between the mouse point you can use the two lines you have drawn on the picture and just calculate the angle between them.
Check out this answer:
Calculating the angle between two lines without having to calculate the slope? (Java)

Photoshop smart object: get rotation angle via Applescript?

I have tried and failed to find an Applescript code that returns a smart object's current rotation angle in Photoshop. Anyone have an idea of where that property is listed? I'm beginning to think this feature isn't currently supported by Applescript.
In Photoshop, objects like a selection has no angle value, because it means nothing: if your selection is made by multiple segments making a complexe shape, there is no mathematical way you can define angle for that shape !
However, you can work with boundary rectangle (which includes that shape). You can rotate this complete boundary (i.e. the selection) and then you will get a new boundary (new rectangle where new rotated shape fits in).
A boundary rectangle is made of a list of for values :
top left corner horizontal position (X1)
top left corner vertical position (Y1)
bottom right corner horizontal position (X2)
bottom right corner vertical position (Y2)
Positions are real numbers, starting with border of canvas (not border of layer ! so you may have negative values). The units depends of the unit of measure of the document.
Once that's clear (I hope !) if you use mathematical calculation between initial boundary and new boundary, you can calculate the rotation angle:
(Pythagore triangle)
If you assume that initial rectangle borders were vertical and horizontal :
cosinus (Teta) = (X2-X1) / (X'2 - X'1)
Teta = angle you are looking for
X1, X2 are the positions of the boundary corners before rotation and X'1, X'2 are position of same corners after rotation.
Please note that this method is OK for selection (any shape), or layers.
It should also be OK for the full canvas, but I never test it for canvas.

How to do an unfold / unwrap animation for cylinder shape in Three.js?

I try to do a cylinder unwrap animation for students to better understand the three surfaces of a cylinder.
It should look like this (found on youtube):
I can draw both circles (bottom and top) using THREE.CylinderGeometry
I can draw the lateral surface using THREE.CylinderGeometry without filling
But how do I do the outer blue animation of the unfolding "rectangle"?!
I have never done an animation with three.js before, so I would also need a suggestion here. Thanks.
The easiest way for this would be to use 3 meshes :
two CircleGeometry-ies for the circles
one custom Geometry for the unwrapping plane
The plane is actually two sets of vertices that represent a line wrapping/unwrapping over a circle. What controls the movement is that angles between each segments are tweened equally. With N being the number of segments, N being even for simplicity, you need to tween this angle from 0 (line state) to 360/N (circle state) on one side, and to -360/N on the other, beginning at the middle (360/N stands for 180/( N/2 ) on each side).
So in your custom Geometry() you define vertices and faces. Then you tween them with your favorite tweening library. End each update callback with geometry.verticesNeedUpdate=true;.
http://jsfiddle.net/2x4Lbvs0/7/

Resources