FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
HTML-GL/demo/basic-webgl.html at master · PixelsCommander/HTML-GL · GitHub
PixelsCommander
/
HTML-GL
Public
Notifications
You must be signed in to change notification settings
Fork
152
Star
3.5k
Code
Issues
25
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
HTML-GL
/
demo
/
basic-webgl.html
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (55 loc) · 1.89 KB
Breadcrumbs
HTML-GL
/
demo
/
basic-webgl.html
Copy path
File metadata and controls
59 lines (55 loc) · 1.89 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html
>
<
html
>
<
head
lang
="
en
"
>
<
meta
charset
="
UTF-8
"
>
<
title
>
HTML GL demo
</
title
>
</
head
>
<
body
style
="
height: 1024px;
"
>
<
h1
>
HTML GL demo
</
h1
>
<
html-gl
>
This layer is rendered in
<
h1
>
WebGL
</
h1
>
<
span
style
="
color: red;
"
>
because
</
span
>
it have tag name
<
b
>
html-gl
</
b
>
</
html-gl
>
<
button
onclick
="
window.animate()
"
>
Animate WebGL layer
</
button
>
<
button
onclick
="
window.changeNodeContent()
"
>
Change layer content
</
button
>
<
button
onclick
="
window.changeNodeTransform()
"
>
Simply change layer`s style.transform
</
button
>
<
h2
>
TODO
</
h2
>
<
ul
>
<
li
>
Add more effects presets
</
li
>
</
ul
>
<
script
src
="
../dist/htmlgl.js
"
>
</
script
>
<
script
>
window
.
changeNodeContent
=
function
(
)
{
document
.
getElementsByTagName
(
'html-gl'
)
[
0
]
.
textContent
=
'Animation was smooth, was not it? This is a new content. It is still visible in dev tools, affects HTML layout and is rendered via WebGL.'
;
}
window
.
changeNodeTransform
=
function
(
)
{
var
element
=
document
.
getElementsByTagName
(
'html-gl'
)
[
0
]
;
element
.
style
.
webkitTransform
=
'translateX(400px) translateY(100px)'
;
element
.
style
.
transform
=
'translateX(400px) translateY(100px)'
;
}
document
.
addEventListener
(
'keydown'
,
function
(
)
{
window
.
devicePixelRatio
=
window
.
devicePixelRatio
===
1
?
2
:
1
;
HTMLGL
.
context
.
resizeViewer
(
)
;
}
)
;
window
.
animate
=
function
(
)
{
var
element
=
document
.
getElementsByTagName
(
'html-gl'
)
[
0
]
;
var
v
=
Velocity
(
element
,
{
translateX
:
100
,
translateY
:
100
,
scaleX
:
4
,
scaleY
:
4
,
rotateZ
:
"360deg"
}
,
{
duration
:
5000
}
)
.
then
(
function
(
)
{
Velocity
(
element
,
{
translateX
:
0
,
translateY
:
0
,
scaleX
:
1
,
scaleY
:
1
,
rotateZ
:
"0"
}
,
{
duration
:
5000
}
)
;
}
)
;
}
</
script
>
</
body
>
</
html
>
Back
|
FazBrowse Home
|
New Git URL