File tree 2 files changed +42
-0
lines changed
2 files changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -870,6 +870,26 @@ <h4 class="heading settled heading" data-level=3.4.2 id=elementmap><span class=s
870
870
it’s then looked for in the document as normal.
871
871
</ ul >
872
872
873
+ < div class =example >
874
+ For example, fancy animating backgrounds can be done with an external canvas:
875
+
876
+ < pre > <script>
877
+ var bg = document.createElement('canvas');
878
+ bg.height = 200;
879
+ bg.width = 1000;
880
+ drawFancyBackground(bg);
881
+ CSS.elementSources.set('fancy', bg);
882
+ </script>
883
+ <style>
884
+ h1 {
885
+ background-image: element(#fancy);
886
+ }
887
+ </style>
888
+ </ pre >
889
+ < p > As the "fancy" canvas is drawn into and animated,
890
+ the backgrounds of all the H1 elements will automatically update in tandem.
891
+ </ div >
892
+
873
893
< h4 class ="heading settled heading " data-level =3.4.3 id =element-cycles > < span class =secno > 3.4.3 </ span > < span class =content >
874
894
Cycle Detection</ span > < a class =self-link href =#element-cycles > </ a > </ h4 >
875
895
Original file line number Diff line number Diff line change @@ -840,6 +840,28 @@ <h4 id='elementmap'>
840
840
it's then looked for in the document as normal.
841
841
</ ul >
842
842
843
+ < div class ='example '>
844
+ For example, fancy animating backgrounds can be done with an external canvas:
845
+
846
+ < pre >
847
+ <script>
848
+ var bg = document.createElement('canvas');
849
+ bg.height = 200;
850
+ bg.width = 1000;
851
+ drawFancyBackground(bg);
852
+ CSS.elementSources.set('fancy', bg);
853
+ </script>
854
+ <style>
855
+ h1 {
856
+ background-image: element(#fancy);
857
+ }
858
+ </style>
859
+ </ pre >
860
+
861
+ As the "fancy" canvas is drawn into and animated,
862
+ the backgrounds of all the H1 elements will automatically update in tandem.
863
+ </ div >
864
+
843
865
< h4 id ='element-cycles '>
844
866
Cycle Detection</ h4 >
845
867
You can’t perform that action at this time.
0 commit comments