This function animates an object between two states. This animates objects separately from the transformations set in `group_objects()` and in the object transformations themselves. This creates motion blur, controlled by the shutter open/close options in `render_scene()`.
animate_objects(
scene,
start_time = 0,
end_time = 1,
start_pivot_point = c(0, 0, 0),
start_position = c(0, 0, 0),
start_angle = c(0, 0, 0),
start_order_rotation = c(1, 2, 3),
start_scale = c(1, 1, 1),
start_axis_rotation = NA,
end_pivot_point = c(0, 0, 0),
end_position = c(0, 0, 0),
end_angle = c(0, 0, 0),
end_order_rotation = c(1, 2, 3),
end_scale = c(1, 1, 1),
end_axis_rotation = NA
)
Tibble of pre-existing object locations.
Default `0`. Start time of movement.
Default `1`. End time of movement.
Default `c(0,0,0)`. The point about which to pivot, scale, and move the objects.
Default `c(0,0,0)`. Vector indicating where to offset the objects.
Default `c(0,0,0)`. Angle of rotation around the x, y, and z axes, applied in the order specified in `order_rotation`.
Default `c(1,2,3)`. The order to apply the rotations, referring to "x", "y", and "z".
Default `c(1,1,1)`. Scaling factor for x, y, and z directions for all objects.
Default `NA`. Provide an axis of rotation and a single angle (via `angle`) of rotation
Default `c(0,0,0)`. The point about which to pivot, scale, and move the group.
Default `c(0,0,0)`. Vector indicating where to offset the objects.
Default `c(0,0,0)`. Angle of rotation around the x, y, and z axes, applied in the order specified in `order_rotation`.
Default `c(1,2,3)`. The order to apply the rotations, referring to "x", "y", and "z".
Default `c(1,1,1)`. Scaling factor for x, y, and z directions for all objects.
Default `NA`. Provide an axis of rotation and a single angle (via `angle`) of rotation around that axis.
Tibble of animated object.
#Render a pig
if(run_documentation()) {
generate_studio() %>%
add_object(pig(y=-1.2,scale=0.5,angle=c(0,-70,0)))%>%
add_object(sphere(y=5,x=5,z=5,radius=2,material=light())) %>%
render_scene(samples=128,sample_method = "sobol_blue")
}
if(run_documentation()) {
#Render a moving pig
generate_studio() %>%
add_object(
animate_objects(
pig(y=-1.2,scale=0.5,angle=c(0,-70,0)),
start_position = c(-0.1,0,0), end_position = c(0.1,0.2,0))
) %>%
add_object(sphere(y=5,x=5,z=5,radius=2,material=light())) %>%
render_scene(samples=128,sample_method = "sobol_blue",clamp_value = 10)
}
if(run_documentation()) {
#Render a shrinking pig
generate_studio() %>%
add_object(
animate_objects(
pig(y=-1.2,scale=0.5,angle=c(0,-70,0)),
start_scale = c(1,1,1), end_scale = c(0.5,0.5,0.5))
) %>%
add_object(sphere(y=5,x=5,z=5,radius=2,material=light())) %>%
render_scene(samples=128,sample_method = "sobol_blue",clamp_value = 10)
}
if(run_documentation()) {
#Render a spinning pig
generate_studio() %>%
add_object(
animate_objects(
pig(y=-1.2,scale=0.5,angle=c(0,-70,0)),
start_angle = c(0,-30,0), end_angle = c(0,30,0))
) %>%
add_object(sphere(y=5,x=5,z=5,radius=2,material=light())) %>%
render_scene(samples=128,sample_method = "sobol_blue",clamp_value = 10)
}
if(run_documentation()) {
#Shorten the open shutter time frame
generate_studio() %>%
add_object(
animate_objects(
pig(y=-1.2,scale=0.5,angle=c(0,-70,0)),
start_angle = c(0,-30,0), end_angle = c(0,30,0))
) %>%
add_object(sphere(y=5,x=5,z=5,radius=2,material=light())) %>%
render_scene(samples=128,sample_method = "sobol_blue",clamp_value = 10,
shutteropen=0.4, shutterclose = 0.6)
}
if(run_documentation()) {
#Change the time frame when the shutter is open
generate_studio() %>%
add_object(
animate_objects(
pig(y=-1.2,scale=0.5,angle=c(0,-70,0)),
start_angle = c(0,-30,0), end_angle = c(0,30,0))
) %>%
add_object(sphere(y=5,x=5,z=5,radius=2,material=light())) %>%
render_scene(samples=128,sample_method = "sobol_blue",clamp_value = 10,
shutteropen=0, shutterclose = 0.1)
}
if(run_documentation()) {
#Shorten the time span in which the movement occurs (which, in effect,
#increases the speed of the transition).
generate_studio() %>%
add_object(
animate_objects(start_time = 0, end_time=0.1,
pig(y=-1.2,scale=0.5,angle=c(0,-70,0)),
start_angle = c(0,-30,0), end_angle = c(0,30,0))
) %>%
add_object(sphere(y=5,x=5,z=5,radius=2,material=light())) %>%
render_scene(samples=128,sample_method = "sobol_blue",clamp_value = 10,
shutteropen=0, shutterclose = 0.1)
}