Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Faizi
ARproject1
Commits
55383a6c
Commit
55383a6c
authored
11 months ago
by
Faizi
Browse files
Options
Download
Email Patches
Plain Diff
Upload New File
parent
824f454a
No related merge requests found
Pipeline
#9792
passed with stage
in 6 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/1-Cube.html
+67
-0
public/1-Cube.html
with
67 additions
and
0 deletions
+67
-0
public/1-Cube.html
0 → 100644
+
67
-
0
View file @
55383a6c
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<title>
AR.js Example
</title>
<script
src=
"https://aframe.io/releases/1.2.0/aframe.min.js"
></script>
<script
src=
"https://cdn.rawgit.com/jeromeetienne/AR.js/1.7.6/aframe/build/aframe-ar.js"
></script>
<style>
body
{
font-family
:
Arial
,
sans-serif
;
text-align
:
center
;
background-color
:
#f4f4f4
;
margin
:
0
;
padding
:
0
;
}
.button
{
background-color
:
#003366
;
color
:
white
;
padding
:
15px
25px
;
margin
:
10px
;
border
:
none
;
border-radius
:
4px
;
cursor
:
pointer
;
font-size
:
16px
;
}
.button
:hover
{
background-color
:
#0055aa
;
}
.hidden
{
display
:
none
;
}
</style>
</head>
<body>
<button
class=
"button"
onclick=
"activateXR()"
>
Start AR Scene
</button>
<button
class=
"button"
onclick=
"captureScene()"
>
Capture Scene
</button>
<a-scene
embedded
arjs
class=
"hidden"
>
<a-marker
preset=
"hiro"
>
<a-box
position=
"0 0.5 0"
material=
"color: red"
animation=
"property: rotation; to: 360 360 360; loop: true; dur: 10000"
></a-box>
</a-marker>
<a-entity
camera
></a-entity>
</a-scene>
<script>
function
activateXR
()
{
const
scene
=
document
.
querySelector
(
"
a-scene
"
);
scene
.
classList
.
remove
(
"
hidden
"
);
}
function
captureScene
()
{
const
canvas
=
document
.
querySelector
(
"
canvas
"
);
if
(
canvas
)
{
const
dataURL
=
canvas
.
toDataURL
(
"
image/png
"
);
const
link
=
document
.
createElement
(
"
a
"
);
link
.
href
=
dataURL
;
link
.
download
=
"
AR_Scene.png
"
;
link
.
click
();
}
else
{
alert
(
"
No AR scene to capture!
"
);
}
}
</script>
</body>
</html>
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets