File tree Expand file tree Collapse file tree 4 files changed +86
-2
lines changed
content/reference/components Expand file tree Collapse file tree 4 files changed +86
-2
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,9 @@ layout: API
99
1010``` js
1111export default function App () {
12+ const imageAddress = ' https://picsum.photos/200' ;
1213 return < image
13- style= {{ height: 200 , objectFit: ' scale-down ' }}
14+ style= {{ height: 300 , objectFit: ' fit ' }}
1415 source= {imageAddress} / > ;
1516};
1617```
@@ -19,5 +20,5 @@ export default function App() {
1920
2021### Properties
2122
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.
2324- ** 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 5353 "title" : " icon" ,
5454 "path" : " /reference/components/icon"
5555 },
56+ {
57+ "title" : " image" ,
58+ "path" : " /reference/components/image"
59+ },
5660 {
5761 "title" : " input" ,
5862 "path" : " /reference/components/input"
6569 "title" : " html" ,
6670 "path" : " /reference/components/html"
6771 },
72+ {
73+ "title" : " rawimage" ,
74+ "path" : " /reference/components/rawimage"
75+ },
6876 {
6977 "title" : " script" ,
7078 "path" : " /reference/components/script"
7179 },
7280 {
7381 "title" : " style" ,
7482 "path" : " /reference/components/style"
83+ },
84+ {
85+ "title" : " video" ,
86+ "path" : " /reference/components/video"
7587 }
7688 ]
7789 },
You can’t perform that action at this time.
0 commit comments