Trying to adjust this "Wave a flag" example

In the Beginner Example in step 7, a fixed texture is loaded.

Note: function flagwaving( t )

(from the Collection of examples from discourse.threejs.org)