Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
leverjs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OpenSource
leverjs
Commits
fe4b6c99
Commit
fe4b6c99
authored
2 years ago
by
la_29
Browse files
Options
Downloads
Patches
Plain Diff
rotate a 3D figure
parent
dfc9a245
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
matlab/+MovieMaker/goFigureAnimation.m
+49
-0
49 additions, 0 deletions
matlab/+MovieMaker/goFigureAnimation.m
with
49 additions
and
0 deletions
matlab/+MovieMaker/goFigureAnimation.m
0 → 100644
+
49
−
0
View file @
fe4b6c99
% this code can be functionalized
% can also add features:
% periodicity toggle? if true remove final frame
% changing number of inbetweens to speed up or slow down the animation
fileName
=
'ssfClustering'
;
% name of movie generated
frameRate
=
30
;
% desired frame rate
duration
=
30
;
% desired length of movie in seconds
azimuthList
=
[
-
20
,
-
110
,
-
190
,
-
290
,
-
380
];
% camera pan angle at key frames
elevationList
=
[
10
,
10
,
10
,
10
,
10
];
% camera tilt angle at key frames
v
=
VideoWriter
(
fileName
,
'MPEG-4'
);
v
.
FrameRate
=
frameRate
;
open
(
v
);
% interpolate viewing angles between key frames to match the specified duration
keyFrameList
=
[
azimuthList
;
elevationList
]
'
;
numFrames
=
round
(
duration
*
frameRate
);
intervalLength
=
(
numFrames
-
1
)
/
(
size
(
keyFrameList
,
1
)
-
1
);
% initialize the angleList
angleList
=
zeros
(
numFrames
,
2
);
for
numKeyFrame
=
1
:
size
(
keyFrameList
,
1
)
-
1
firstRow
=
round
(
intervalLength
*
(
numKeyFrame
-
1
)
+
1
);
% first row of the interval between key frames
lastRow
=
round
(
intervalLength
*
numKeyFrame
+
1
);
% last row of the interval between key frames
a
=
keyFrameList
(
numKeyFrame
,
1
);
% initial key frame azimuth angle
b
=
keyFrameList
(
numKeyFrame
+
1
,
1
);
% ending key frame azimuth angle
c
=
keyFrameList
(
numKeyFrame
,
2
);
% initial key frame elevation angle
d
=
keyFrameList
(
numKeyFrame
+
1
,
2
);
% ending key frame elevation angle
n
=
round
(
intervalLength
*
numKeyFrame
)
-
round
(
intervalLength
*
(
numKeyFrame
-
1
))
+
1
;
% number of angles to add
angleList
(
firstRow
:
lastRow
,:)
=
[
linspace
(
a
,
b
,
n
)
.
' , linspace(c,d,n).'
];
end
% capture frames and write to the movie file
for
frame
=
1
:
size
(
angleList
,
1
)
view
(
angleList
(
frame
,:));
drawnow
;
writeVideo
(
v
,
getframe
(
gcf
));
end
close
(
v
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment