I'm wondering if anyone can direct me to an After Effects wiggle expression that will control the wiggle so that it only wiggles in the y direction, AND only wiggles upwards, like it's wiggling against a floor? I'm trying to animate a hatching egg that seems to randomly jump up a bit.
I'm new to After Effects and not sure how to write the code that's required. All other resources that I've found online have been for a standard wiggle effect that doesn't fit my needs.
Thanks!
Looks like you're looking for a clamped wiggle. Check out the wiggles variations post in our expressions library: https://reelsmart.co/expression-library/wiggle/
Related
I have an assignment about working with pictures that depth cameras take.
First thing first, this is how one of these pictures looks like.
The way the camera works is that it represents objects in different tones of color depending on how far they are from the camera lens. The closer something is the brighter the color gets. Farther = darker of course.
My assignment is that I basically need to make a people counter for a depth camera that is located in an elevator.
What my idea is that I would basically like to convert the image to a 2D matrix of numbers and then apply a local maximum finder algorithm in order to find those heads sticking out towards the camera so I can count the people in that way.
So, my questions are -
Is this an okay approach for someone who is not very experienced?
What tools should I use for the conversion?
Can I do all of this in C or should I use something more advanced?
I haven't had much experience outside of C but I'm open to trying maybe C# if it provides more advanced and better tools for the job.
All advice appreciated!
Currently working on a project to read the gauges on our chiller. I'm not a programmer by trade, so I'm trying to learn as I go, but SimpleCV's documentation isn't that great (IMO...)
At the moment I'm doing a findLines on each image, and it sort of works, but will occasionaly find a "line" on the edge of the gauge itself, or return some other weird result.
What I'd like to do is paint the gauge pivot one color, and the tip of the needle another color, and measure the angle between the two. I think I have the color blob detection figured out, but I can't figure out the measuring the angle part.
Anyone have any ideas? All I need is the angle to be returned, the BMS system will accept the angle reading and do the scale conversion itself, so that isn't a problem.
one of the core simplecv developers here. Sorry the docs aren't up to snuff.
I think if you can paint the gauge it will probably make it easier, or you may not even need to.
I whipped up the example here as you can see image output along the way as well:
http://nbviewer.ipython.org/github/xamox/sandbox/blob/master/gas-gauge-angle/Gauge%20Angle.ipynb
I'm working on something close to that example and I was wondering if there is a way to specify a transition function to be applied at each draw. I find the constant jumping hurts my eyes and I'd like to use something like:
d3.transition().duration(step).transition("linear")
but it have the gut feeling rickshaw's internals won't allow for that.
Had my go at it here:
https://github.com/RenaudF/d3-plugins/commit/c16dd3bc5558e1974a08bb26fcdb084e7afa9b12
But it turns out that the points are transitioning on their vertical axis instead of from right to left, which makes things worse if anything.
Ok so I have bunch of balls:
What I'm trying to figure out is how to make these circles:
Rotate based on the surfaces they are touching
Fix collision penetration when dealing with multiple touching objects.
EDIT: This is what I mean by rotation
Ball 0 will rotate anti-clockwise as it's leaning on Ball 3
Ball 5 will rotate clockwise as it's leaning on Ball 0
Even though solutions to this are universal, just for the record I'm using Javascript and SVG, and would prefer implementing this myself rather than using a library.
Help would be very much appreciated. Thanks! :)
Here are a few links I think would help you out on your quest:
Box2D
Advanced Character Physics
Javascript Ball Simulation
Box2D has what your looking for, and its open source I believe. You can download the files and see how they do what they do in order to achieve your effect.
Let me know if this helps, trying to get better at answering questions on here. :)
EDIT:
So I went ahead and thought this out just a bit more to give some insight as far as how I would approach it. Take a look at the image below:
Basically, compare the angles on a grid, if the ball is falling +30 degrees compared to the ball it falls on then rotate the ball positively. If its falling -30 degrees compared to the ball it fall on then rotate the ball negatively. Im not saying this is the correct solution, but just thinking about it, this is the way I would approach the problem off the bat.
From a physics standpoint it sounds like you want to conserve both linear and angular momentum.
As a starting point, you'll want establish ODE matrices that model both and then perform some linear algebra to solve them. I personally would use Numpy/Scipy (probably using a sparse array) for that solution. But there are many approaches (sympy comes to mind). What modules do you want to use?
You'll want to familiarize yourself with coefficient of restitution and coefficient of friction and decide if you want to conserve kinetic energy too. (do you want/care if they keep bouncing and rolling around forever?) (you'll probably need energy matrices as well)
You'll be solving these matrices every timestep all the while checking the condition that no two ball centers are closer than the sum of the two radii. (..and if they do, you adjust the momentum and energy terms for a post-collision condition)
This is just the barest of beginnings to a big project. Can I ask why you want to do this from scratch?
I would recommend checking out game physics simulation books and articles. See O'Reilly's Physics for Game Developers and the Gamasutra website, for example.
Modern UI's are starting to give their UI elments nice inertia when moving. Tabs slide in, page transitions, even some listboxes and scroll elments have nice inertia to them (the iphone for example). What is the best algorythm for this? It is more than just gravity as they speed up, and then slow down as they fall into place. I have tried various formulae's for speeding up to a maximum (terminal) velocity and then slowing down but nothing I have tried "feels" right. It always feels a little bit off. Is there a standard for this, or is it just a matter of playing with various numbers until it looks/feels right?
You're talking about two different things here.
One is momentum - giving things residual motion when you release them from a drag. This is simply about remembering the velocity of a thing when the user releases it, then applying that velocity to the object every frame and also reducing the velocity every frame by some amount. How you reduce velocity every frame is what you experiment with to get the feel right.
The other thing is ease-in and ease-out animation. This is about smoothly accelerating/decelerating objects when you move them between two positions, instead of just linearly interpolating. You do this by simply feeding your 'time' value through a sigmoid function before you use it to interpolate an object between two positions. One such function is
smoothstep(t) = 3*t*t - 2*t*t*t [0 <= t <= 1]
This gives you both ease-in and ease-out behaviour. However, you'll more commonly see only ease-out used in GUIs. That is, objects start moving snappily, then slow to a halt at their final position. To achieve that you just use the right half of the curve, ie.
smoothstep_eo(t) = 2*smoothstep((t+1)/2) - 1
Mike F's got it: you apply a time-position function to calculate the position of an object with respect to time (don't muck around with velocity; it's only useful when you're trying to figure out what algorithm you want to use.)
Robert Penner's easing equations and demo are superb; like the jQuery demo, they demonstrate visually what the easing looks like, but they also give you a position time graph to give you an idea of the equation behind it.
What you are looking for is interpolation. Roughly speaking, there are functions that vary from 0 to 1 and when scaled and translated create nice looking movement. This is quite often used in Flash and there are tons of examples: (NOTE: in Flash interpolation has picked up the name "tweening" and the most popular type of interpolation is known as "easing".)
Have a look at this to get an intuitive feel for the movement types:
SparkTable: Visualize Easing Equations.
When applied to movement, scaling, rotation an other animations these equations can give a sense of momentum, or friction, or bouncing or elasticity. For an example when applied to animation have a look at Robert Penners easing demo. He is the author of the most popular series of animation functions (I believe Adobe's built in ones are based on his). This type of transition works equally as well on alpha's (for fade in).
There is a bit of method to the usage. easeInOut start slow, speeds up and the slows down. easeOut starts fast and slows down (like friction) and easeIn starts slow and speeds up (like momentum). Depending on the feel you want you choose the appropriate one. Then you choose between Sine, Expo, Quad and so on for the strength of the effect. The others are easy to work out by their names (e.g. Bounce bounces, Back goes a little further then comes back like an elastic).
Here is a link to the equations from the popular Tweener library for AS3. You should be able to rewrite these in JavaScript (or any other language) with little to no trouble.
It's playing with the numbers.. What feels good is good.
I've tried to develop magic formulas myself for years. In the end the ugly hack always felt best. Just make sure you somehow time your animations properly and don't rely on some kind of redraw/refresh rate. These tend to change based on the OS.
Im no expert on this either, but I beleive they are done with quadratic formulas, that, when given the correct parameters, start fast or slow and dramatically increase or decrease towards the end until a certain point is reached.