- /
-
Moving Cube
on 13 Oct 2024
- 70
- 182
- 0
- 0
- 349
Cite your audio source here (if applicable):
drawframe(1);
Write your drawframe function below
function drawframe(f)
clf;
axis([-10 10 -10 10 -10 10]);
axis off;
set(gca, 'Color', 'k');
set(gca, 'XColor', 'y', 'YColor', 'y', 'ZColor', 'y');
view(3);
[X, Y, Z] = meshgrid(-1:1:1, -1:1:1, -1:1:1);
numPoints = numel(X);
colors = repmat(abs(sin(f/24)), numPoints, 1);
scatter3(X(:), Y(:), Z(:), 100, colors, 'filled');
rotateAngle = f * (360 / 96);
rotate3d on;
camorbit(rotateAngle, 0);
drawnow;
end