-
Notifications
You must be signed in to change notification settings - Fork 0
/
11-Mixin.html
48 lines (48 loc) · 1.42 KB
/
11-Mixin.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mixin (seperti CSS)</title>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<!-- Mixin tidak terbatas pada komponen visual tapi juga mencakup komponen perilaku -->
<a-mixin
id="kotakmerah"
geometry="primitive:box;"
material="color:#ff0000;"
></a-mixin>
<a-mixin
id="berputar"
animation="property:rotation;
dur:2000;
to:0 360 0;
loop:true;
startEvents:click;"
></a-mixin>
<a-mixin
id="hijau"
material="color:#00ff00"
></a-mixin>
</a-assets>
<a-camera><a-cursor></a-cursor></a-camera>
<!-- Perilaku yang paling kanan yang berlaku -->
<a-entity
position="0 1.5 -3"
mixin="hijau kotakmerah"
></a-entity>
<a-entity
position="2 1.5 -3"
mixin="kotakmerah hijau berputar"
></a-entity>
<a-entity
position="-2 1.5 -3"
mixin="berputar hijau kotakmerah"
material="color:#aaaa00"
></a-entity>
</a-scene>
</body>
</html>