Animation in SketchUp
-
Somewhere amongst Martin's Uncle Holly speak you can find something sensible but contorted like: "During that interval the conductor (again, UI.timer based, but only one timer) will pass frame ticks back to the registered object(s)." This is better explained somewhere I can't find at the moment, but it's important. Will post again when found.
-
Why wouldn't you want to use Scenes to define the keyframes?
Our (vaporous) dialog would allow defining what happens to objects between the keyframes (scenes): sets the number of frames (or seconds), easings, etc.
But there is more types of animation than moving - what about rotation? color? model time (shadows)? focal length?, etc.
You do not want to just move objects, you want to animate the properties of objects (meant in a Ruby context.)
Properties include things such as .transformation of Groups, colors (.blend) can be animated, Page properties (i.e. fog). Any property in the SketchUp app for which setter and getter methods can be created can also be animated using the same framework; if the framework is written in a general way.
So if a Group has a
.transformation
(and matching.transformation=
) property - you want to animate it's transformation as opposed to it's position. So an object needs setter and getter methods for the property to be animated. If they do not exists, they can be added to the object; as in the Camera; which for whatever reason lacks direct manipulation via a Transformation.I posted a couple code snippets that are the beginnings of such a system: http://forums.sketchucation.com/viewtopic.php?f=180&t=25119
-
But please don't use timers - use the Animation class. Renderers already support it for rendering animations - I'm not sure they can hook into timer-based anims. My snippet in the previous post uses the Animation class.
-
For my usage - animation would only be relevant if it would be possible to render it.
-
How exactly do renderers work with object animation - like in Sketchyphysics? How can they capture that movement?
In my camera recorder script I ended up making a scene for each frame of the animation so that a renderer would be able to process scenes. But how can they use animation information? Is it something most of them have built in and it just a matter of writing the code according to their standards? Or do they have to implement object animation for each plugin that comes along and offers its own animation solution?
chris
-
@chris fullmer said:
How exactly do renderers work with object animation - like in Sketchyphysics? How can they capture that movement?
I don't kow the answer to that. SketchyPhysics does use the Animation class, and I assume uses the physics engine to do the heavy calculations needed.
They must be able to hook into that animation from the c/c++ code, since there can only be a single animation active at a time.
-
I see two different ways to do animation in SU. Both good in their own way:
-
Fly around in realtime with something like LightUp's Tourtool mixed with Chris Fullmers Record camera. Then enhanced with a way of manually adjusting curves to reposition camera/object.
-
Keyframe based animation with a timeline. Maybe a tool to drag and rotate the camera to the right position. A bit like the walktool but dragging instead of pushing the camera for better control. Maybe even adjustable curves in the UI like most animation software have. (I know you can draw curves like that with javascript.)
-
-
@chrisglasier said:
Will post again when found.
Looping: Single vs. Multiple vs. Fixed Timelines, amongst other things.
Also the demo - Click and drag to create more.
-
@jim said:
Why wouldn't you want to use Scenes to define the keyframes?
Our (vaporous) dialog would allow defining what happens to objects between the keyframes (scenes): sets the number of frames (or seconds), easings, etc.
Sorry I missed this probably because of the vapor pouring from my brow.
The dialog basically deeply nests components and scenes in multiple collections, and records what components appear in what scenes, purchase orders and so on. All of this I am sure could be helpful in creating a conventional animation, but what I am more interested in is using it to create "living" 3D reports. Imagine a project manager having an automatically updating AR model sitting on his desk instead of huge piles of drawings, site reports, change orders and so forth.
So I shy away from keyframes - not because I think they are wrong but because I want to see how far I can get towards what I described.
-
@jim said:
But there is more types of animation than moving - what about rotation? color? model time (shadows)? focal length?, etc.
I've got my Conductor running. He's Timer based. I'll see if I can switch him to Animation.
He calls the
run()
method of objects that register during an interval they request. What your object'srun()
does is up to your object: move, rotate, scale, fly, explode ...I've had nothing but issues with materials. Do simple colors work w/o Bug Splats?
-
Yup. I use colors in many scripts and I've never plsatted from them. Though I've never had a texture splat on me either, so it might just be a workflow thing?
-
@chris fullmer said:
Yup. I use colors in many scripts and I've never plsatted from them. Though I've never had a texture splat on me either, so it might just be a workflow thing?
Thanks. We're off topic. I'll reraise this as Wood Cherry Original.
-
@martinrinehart said:
I've had nothing but issues with materials. Do simple colors work w/o Bug Splats?
I remember from another thread that you demonstrated that you used
entity.material = 'materialname'
, correct? Have you tried instead doingentity.material = model.materials['materialname']
I've also never had problems working with materials, textured or not, in SU ruby.
-
For animation, I do appreciate where your coming from on this Chris. Database driven animation is very important. I would love to see the two work side by side, maybe even hand in hand I'm sure they can, since its all just about the computer knowing when to start and stop an animation for specific object. It doesn't care if the markers are recorded in frames or days. I think a masterful GUI would be able to handle it all.
Chris
-
In reply to #1
Another reason not to use a SketchUp timer is that is is an integer timer - it will round decimal values to the nearest whole number.
#2 - that is a solid way to do it. Yes, scaling does not work when interpolating the matrix. I never got around to trying to animate the scale of a Group/Instance.
-
@jim said:
Another reason not to use a SketchUp timer is that is is an integer timer - it will round decimal values to the nearest whole number.
Do we have other timer options?
-
When using the Animation class, you call view.show_frame(delay) with an optional delay argument. The question is if this delay can be fractional seconds, or is limited to whole seconds. If whole seconds, then you still will not be able to control the in-model frame-rate (which is really not important because the output frame-rate can be set.)
-
-
BTM's Animation Plugin moved here: http://forums.sketchucation.com/viewtopic.php?f=323&t=25196&p=215878#p215878
-
@jim said:
Another reason not to use a SketchUp timer is that is is an integer timer - it will round decimal values to the nearest whole number.
I want to switch to Animation, but in the mean time I'm getting good timer results at 25 frames per second. Wish I could explain this:
# /r2/t.rb require 'sketchup' i = 0 start = Time.now() id = UI.start_timer( 1.0/25, true ) { i += 1 if i > 25 UI.stop_timer( id ) puts Time.now() - start end } puts Time.now() - start
Advertisement