File tree 4 files changed +86
-2
lines changed
content/reference/components
4 files changed +86
-2
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ layout: API
9
9
10
10
``` js
11
11
export default function App () {
12
+ const imageAddress = ' https://picsum.photos/200' ;
12
13
return < image
13
- style= {{ height: 200 , objectFit: ' scale-down ' }}
14
+ style= {{ height: 300 , objectFit: ' fit ' }}
14
15
source= {imageAddress} / > ;
15
16
};
16
17
```
@@ -19,5 +20,5 @@ export default function App() {
19
20
20
21
### Properties
21
22
22
- - ** source** : Source of the image. Can be a url or the ` Texture2D ` object.
23
+ - ** source** : Source of the image. Can be a url, the ` Texture2D ` object or the ` Sprite ` object.
23
24
- ** fit** : Determines how to position the image inside the element.
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : <rawimage>
3
+ layout : API
4
+ ---
5
+
6
+ ` <rawimage> ` creates an rawimage component.
7
+
8
+ <Sandpack >
9
+
10
+ ``` js
11
+ import { useState , useEffect } from ' react' ;
12
+
13
+ export default function App () {
14
+ return (
15
+ < rawimage
16
+ style= {{ height: 300 }}
17
+ source= ' https://picsum.photos/200' / >
18
+ );
19
+ };
20
+ ```
21
+
22
+ </Sandpack >
23
+
24
+ ### Properties
25
+
26
+ - ** source** : Source of the image. Can be a url, the ` Texture2D ` object or the ` Sprite ` object.
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : <video>
3
+ layout : API
4
+ ---
5
+
6
+ ` <video> ` creates an video component.
7
+
8
+ <Sandpack >
9
+
10
+ ``` js
11
+ import { useState , useEffect } from ' react' ;
12
+
13
+ export default function App () {
14
+ const videoAddress = ' http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4' ;
15
+
16
+ const [videoRef , setVideoRef ] = useState ();
17
+
18
+ useEffect (() => {
19
+ if (videoRef) {
20
+ videoRef .VideoPlayer .Play ();
21
+ }
22
+ }, [videoRef]);
23
+
24
+ const toggleVideo = () => {
25
+ const vp = videoRef .VideoPlayer ;
26
+ if (vp .isPlaying ) vp .Pause ();
27
+ else vp .Play ();
28
+ };
29
+
30
+ return <>
31
+ < video
32
+ style= {{ objectFit: ' contain' , width: 500 }}
33
+ source= {videoAddress}
34
+ ref= {setVideoRef}
35
+ onPointerClick= {toggleVideo}
36
+ / >
37
+ < / > ;
38
+ };
39
+ ```
40
+
41
+ </Sandpack >
42
+
43
+ ### Properties
44
+
45
+ - ** source** : Source of the image. Can be a url, a ` Video ` object.
Original file line number Diff line number Diff line change 53
53
"title" : " icon" ,
54
54
"path" : " /reference/components/icon"
55
55
},
56
+ {
57
+ "title" : " image" ,
58
+ "path" : " /reference/components/image"
59
+ },
56
60
{
57
61
"title" : " input" ,
58
62
"path" : " /reference/components/input"
65
69
"title" : " html" ,
66
70
"path" : " /reference/components/html"
67
71
},
72
+ {
73
+ "title" : " rawimage" ,
74
+ "path" : " /reference/components/rawimage"
75
+ },
68
76
{
69
77
"title" : " script" ,
70
78
"path" : " /reference/components/script"
71
79
},
72
80
{
73
81
"title" : " style" ,
74
82
"path" : " /reference/components/style"
83
+ },
84
+ {
85
+ "title" : " video" ,
86
+ "path" : " /reference/components/video"
75
87
}
76
88
]
77
89
},
You can’t perform that action at this time.
0 commit comments