Skip to content

Commit f425e87

Browse files
committed
lower default framerate for docs animations
1 parent 264165e commit f425e87

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

docs/make.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ using Multibody
22
using Documenter
33
using CairoMakie
44
ENV["JULIA_DEBUG"]=Documenter # Enable this for debugging
5+
ENV["DOCS_BUILD"] = true # used to lower the default frame rate in animations for the docs
56

67
DocMeta.setdocmeta!(Multibody, :DocTestSetup, :(using Multibody); recursive = true)
78

docs/src/examples/kinematic_loops.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Multibody.jl supports automatic 3D rendering of mechanisms, we use this feature
8181

8282
```@example kinloop
8383
import CairoMakie
84-
Multibody.render(fourbar, sol, 0:0.033:10; x=4, y=-1, z=4, lookat=[0, -1, 0], filename = "fourbar.gif") # Use "fourbar.mp4" for a video file
84+
Multibody.render(fourbar, sol, 0:0.05:10; x=4, y=-1, z=4, lookat=[0, -1, 0], filename = "fourbar.gif") # Use "fourbar.mp4" for a video file
8585
nothing # hide
8686
```
8787

ext/Render.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,27 @@ function default_scene(x,y,z; lookat=Vec3f(0,0,0),up=Vec3f(0,1,0),show_axis=fals
108108
scene, fig
109109
end
110110

111+
function default_framerate(filename)
112+
if parse(Bool, get(ENV, "DOCS_BUILD", "false"))
113+
return 20
114+
elseif lowercase(last(splitext(filename))) == ".gif"
115+
return 25
116+
else
117+
return 30
118+
end
119+
end
111120

112121
function render(model, sol,
113122
timevec::Union{AbstractVector, Nothing} = nothing;
114-
framerate = 30,
123+
filename = "multibody_$(model.name).mp4",
124+
framerate = default_framerate(filename),
115125
x = 2,
116126
y = 0.5,
117127
z = 2,
118128
lookat = Vec3f(0,0,0),
119129
up = Vec3f(0,1,0),
120130
show_axis = false,
121131
timescale = 1.0,
122-
filename = "multibody_$(model.name).mp4",
123132
kwargs...
124133
)
125134
scene, fig = default_scene(x,y,z; lookat,up,show_axis)

0 commit comments

Comments
 (0)