Sketchy physics replay - Mac
-
I'm trying to take advantage of one of the great assets of the mac version of sketch up and sketchy physics, the transparent background. Any suggestion on how to capture frames in sketchy physics so that the background is transparent. For now I am just exporting an image per frame so that I can control the resolution and frame size but I would guess there is a better way and a better tinkerer out there who can tell me. This code was nicked from Mr. K and works to interpolate camera positions between scenes while saving an image every frame. Put the code in the on tick box of any sketchy physics solid.
if frame==0 @transition_time=100 @pages=Sketchup.active_model.pages @cam=Sketchup.active_model.active_view.camera @view=Sketchup.active_model.active_view @page_num=@pages.count-1 @cur_page=0 @next_page=1 end if frame>0 per=frame%@transition_time if per==0 @cur_page+=1 @next_page+=1 @cur_page=0 if(@cur_page>@page_num) @next_page=0 if(@next_page>@page_num) end per=per.to_f/@transition_time page_cam1=@pages[@cur_page].camera page_cam2=@pages[@next_page].camera fov,eye,target,up=interpolate_camera(page_cam1,page_cam2,per) @cam.fov=fov @cam.set(eye,target,up) @newview=@view.refresh framet=frame.to_s while framet.length< 4 framet="0"+framet end @name="/Users/markptak/Desktop/tempimage/write_image."+framet+".png" keys={ ;filename => @name, ;width => 1924, ;height => 1080, ;antialias => false, ;compression => 0.9, ;transparent => true } @newview.write_image keys end if frame==0 def interpolate_camera(cam1,cam2,per2) per1=1-per2 fov1=cam1.fov fov2=cam2.fov fov=fov1*per1+fov2*per2 eye=[] eye1=cam1.eye.to_a eye2=cam2.eye.to_a (0..2).each{|index| eye[index]=eye1[index]*per1+eye2[index]*per2} tar=[] tar1=cam1.target.to_a tar2=cam2.target.to_a (0..2).each{|index| tar[index]=tar1[index]*per1+tar2[index]*per2} up=[] up1=cam1.up.to_a up2=cam2.up.to_a (0..2).each{|index| up[index]=up1[index]*per1+up2[index]*per2} return fov,eye,tar,up end end
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement