Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
deanthecoder
ZXBasic
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
ZXBasic
/
Examples
/
CubeSpinner
/
CubeSpinner.bas
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
45 lines (45 loc) · 1.42 KB
main
Breadcrumbs
ZXBasic
/
Examples
/
CubeSpinner
/
CubeSpinner.bas
Copy path
Top
File metadata and controls
Code
Blame
45 lines (45 loc) · 1.42 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
10 REM 3D SPINNING CUBE FOR ZX SPECTRUM
20 BORDER 0: PAPER 0: INK 6: CLS
30 DEF FN R(A)=A*PI/180
40 REM CUBE VERTICES (X, Y, Z) - 8 CORNERS
50 DIM V(8,3): DIM P(8,2): DIM O(8,2)
60 FOR I=1 TO 8: READ V(I,1),V(I,2),V(I,3): NEXT I
70 DATA -20,-20,-20, 20,-20,-20, 20, 20,-20, -20, 20,-20
80 DATA -20,-20, 20, 20,-20, 20, 20, 20, 20, -20, 20, 20
90 REM CUBE EDGES
100 DIM E(12,2)
110 FOR I=1 TO 12: READ E(I,1),E(I,2): NEXT I
120 DATA 1,2, 2,3, 3,4, 4,1
130 DATA 5,6, 6,7, 7,8, 8,5
140 DATA 1,5, 2,6, 3,7, 4,8
150 REM ANGLES AND PERSPECTIVE
160 LET AX=0: LET AY=0: LET AZ=0: LET D=150
170 REM --- MAIN LOOP ---
180 LET CX=COS FN R(AX): LET SX=SIN FN R(AX)
190 LET CY=COS FN R(AY): LET SY=SIN FN R(AY)
200 LET CZ=COS FN R(AZ): LET SZ=SIN FN R(AZ)
210 REM ROTATE AND PROJECT
220 FOR I=1 TO 8
230 LET X=V(I,1): LET Y=V(I,2): LET Z=V(I,3)
240 REM ROTATE X AXIS
250 LET Y1=Y*CX-Z*SX: LET Z1=Y*SX+Z*CX
260 REM ROTATE Y AXIS
270 LET X2=X*CY+Z1*SY: LET Z2=-X*SY+Z1*CY
280 REM ROTATE Z AXIS
290 LET X3=X2*CZ-Y1*SZ: LET Y3=X2*SZ+Y1*CZ
300 REM PERSPECTIVE
310 LET P(I,1)=127+(X3*D)/(Z2+100)
320 LET P(I,2)=87+(Y3*D)/(Z2+100)
330 NEXT I
340 REM DRAW NEW FRAME
350 CLS
360 INK 6
370 FOR I=1 TO 12
380 PLOT P(E(I,1),1),P(E(I,1),2): DRAW P(E(I,2),1)-P(E(I,1),1),P(E(I,2),2)-P(E(I,1),2)
390 NEXT I
400 REM SPIN
410 LET AX=AX+5: LET AY=AY+7: LET AZ=AZ+3
420 IF AX>360 THEN LET AX=AX-360
430 IF AY>360 THEN LET AY=AY-360
440 IF AZ>360 THEN LET AZ=AZ-360
450 GO TO 180
You can’t perform that action at this time.