Animating Transformations

Moderator: Jim

Animating Transformations

Postby Jim » Wed Jun 24, 2009 8:18 pm

I posted a couple of videos on my blog about animating a Group's Transformation using easing functions.

To go from one transformation to the next, I am using Transformation.interpolate - and it works great for the position and rotation components.

I am unable to animate the scale using the same method. The scale just pops at the start of the animations, which is more evidence that SketchUp is storing scaling information in a non-standard way - as mentioned in this topic. :x
0
Hi

Jim 
Global Moderator
 

Re: Animating Transformations

Postby thomthom » Wed Jun 24, 2009 8:42 pm

ah, that topic yea. nearly forgot about it. I still don't fully understand what SU does there. Would be nice if a Google-head could shed some light on this.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: Animating Transformations

Postby Jim » Fri Jun 26, 2009 4:17 pm

For animating Groups and Instances, what should the API look like? In other words, you have a plugin in which you would like to incorporate animations; what is the syntax for defining and running an animation that makes sense to you? I'll leave the question intentionally open-ended.
0
Hi

Jim 
Global Moderator
 

Re: Animating Transformations

Postby thomthom » Fri Jun 26, 2009 4:30 pm

Just some quick brainstorming ideas. Will have to think more about this...
Code: Select all
ani = Animation.new
ani.add_entities(entities)
kf1 = ani.add_keyframe
kf1.move(x,y,y)
kf1.scale(1.2)
kf2 = ani.add_keyframe
kf2.move(x,y,y)
kf2.scale(1.2)
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: Animating Transformations

Postby Jim » Wed Jul 01, 2009 5:44 am

A little code
Code: Select all
def shot1
  a = Animator.new
  car = Sketchup.active_model.entities.instances[0]
  cam = Sketchup.active_model.active_view.camera
  cam1 = Sketchup.active_model.pages[0].camera
  cam2 = Sketchup.active_model.pages[1].camera
  anim = Anim.new(car, 'position', [-1000.feet, 0, 0], {'duration'=>200, 'from'=>ORIGIN})
  a.register anim
  anim = Anim.new(cam, 'position', cam2.position+[0,100,0], {'from'=>cam1.position, 'duration'=>200 } )
  a.register anim
  anim = Anim.new(cam, 'target', cam2.target, {'from'=>cam1.target, 'duration'=>200} )
  a.register anim
  a.start
end

A little video.
0
Hi

Jim 
Global Moderator
 

Re: Animating Transformations

Postby thomthom » Wed Jul 01, 2009 7:14 am

Is that working code?
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: Animating Transformations

Postby Jim » Wed Jul 01, 2009 7:22 am

Yes. I used View.write_image to write a jpg for each frame.

Random positioning.



Boing boing. (Bounce Out Easing.)
Code: Select all
def drop
    a = Animator.new
    groups = Sketchup.active_model.entities.groups
    ins = Sketchup.active_model.entities.instances
    all = groups.concat ins
    all.each {|e|
      next unless e.position.z > 0
   target_pt = e.transformation.origin.clone
   target_pt.z = 0
   anim = Anim.new(e, 'position', target_pt ,{'duration'=>rand(30)+20, 'easing' => 'bounceOut'})
   a.register(anim)
    }
    a.start
end

0
Hi

Jim 
Global Moderator
 

Re: Animating Transformations

Postby Chris Fullmer » Wed Jul 01, 2009 7:23 am

Jim the top video is not available (maybe it will be shortly?)

and the bottom one says its private. So I can't see either right now.

Chris
0
Lately you've been tan, suspicious for the winter.
All my Plugins I've written
User avatar
Chris Fullmer 
SketchUp Team
SketchUp Team
 

Re: Animating Transformations

Postby thomthom » Wed Jul 01, 2009 7:24 am

Fantastic!

btw, the two last videos are "unavailable"...
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: Animating Transformations

Postby Jim » Wed Jul 01, 2009 7:26 am

They should work shortly...

Here's a demo of the easings I have been stealing.

Also been borrowing ideas from here and here.
0
Hi

Jim 
Global Moderator
 

Re: Animating Transformations

Postby thomthom » Wed Jul 01, 2009 7:34 am

Aah! That looks really good!

Which remidns me, I need to talk to ASGVis, if maybe such a project would be of any use for them to be able to make V-Ray render object animations. I'll see what kind of data they need from the model.
0
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom 
PluginStore Author
PluginStore Author
 

Re: Animating Transformations

Postby Jim » Wed Jul 01, 2009 8:08 am

It's fairly limited right now. You can not chain animations - that is, have an object perform 2 (or more) motions in sequence (yet.) And motion along a curve isn't working yet, so you basically can only move straight-line between 2 points. I think Fredo has done most of the work for bezier curves already.
0
Hi

Jim 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Skx Extension Library

Who is online

Users browsing this forum: No registered users and 1 guest

Visit our sponsors: